Note
This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
IndexPartitionBlock#
- class IndexPartitionBlock#
Bases:
object
A custom class for the return of a block of node indices.
The class is a read-only sequence of integers instances.
This class is a container class for the results of the digraph_maximum_bisimulation function. 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 rustworkx as rx graph = rx.generators.directed_path_graph(2) partition = rx.digraph_maximum_bisimulation(graph) a_partition_block = partition[0] # Index based access first_element = a_partition_block[0] # Use as iterator block_iter = iter(a_partition_block) another_element = next(block_iter) the_second_element = next(block_iter)