Warning
The documentation for retworkx has migrated to:
https://qiskit.org/documentation/retworkx
These docs will no longer be updated.
retworkx.NodeIndices¶
- class NodeIndices¶
A custom class for the return of node indices
This class is a container class for the results of functions that return a list of node indices. It implements the Python sequence protocol. So you can treat the return as a read-only sequence/list that is integer indexed. If you want to use it as an iterator you can by wrapping it in an
iter()
that will yield the results in order.For example:
import retworkx graph = retworkx.generators.directed_path_graph(5) nodes = retworkx.node_indexes(0) # Index based access third_element = nodes[2] # Use as iterator nodes_iter = iter(node) first_element = next(nodes_iter) second_element = next(nodes_iter)
- __init__()¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
()Initialize self.