Traversing through nodes in a flow
A common requirement is to identify nodes that are either upstream or downstream of a particular node. The flow provides a number of methods that can be used to identify these nodes. These methods are summarized in the following table.
Method | Return type | Description |
---|---|---|
s.iterator() |
Iterator | Returns an iterator over the node objects that are contained in the specified
flow. If the flow is modified between calls of the next() function, the behavior of
the iterator is undefined. |
s.predecessorAt(node, index) |
Node | Returns the specified immediate predecessor
of the supplied node or None if the index is out
of bounds. |
s.predecessorCount(node) |
int | Returns the number of immediate predecessors of the supplied node. |
s.predecessors(node) |
List | Returns the immediate predecessors of the supplied node. |
s.successorAt(node, index) |
Node | Returns the specified immediate successor of
the supplied node or None if the index is out of
bounds. |
s.successorCount(node) |
int | Returns the number of immediate successors of the supplied node. |
s.successors(node) |
List | Returns the immediate successors of the supplied node. |