graph-builder
Version:
A graph builder library for modeling abstract graph structures.
23 lines (14 loc) • 760 B
Markdown
[Home](./index) > [graph-builder](./graph-builder.md) > [BaseGraph](./graph-builder.basegraph.md) > [predecessors](./graph-builder.basegraph.predecessors.md)
# BaseGraph.predecessors method
Returns all nodes in this graph adjacent to `node` which can be reached by traversing `node`<!-- -->'s incoming edges <i>against</i> the direction (if any) of the edge.
In an undirected graph, this is equivalent to [BaseGraph.adjacentNodes](./graph-builder.basegraph.adjacentnodes.md)<!-- -->.
Throws an error if `node` is not an element of this graph.
**Signature:**
```javascript
predecessors(node: N): Set<N>;
```
**Returns:** `Set<N>`
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| `node` | `N` | |