class RelationalCoarsestPartition#

Bases: object

A custom class for the return of a partition of node indices.

The class is a read-only sequence of NodeIndices instances.

This class is a container class for the results of the digraph_maximum_bisimulation funtion. 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)
# Index based access
a_partition_block = partition[0]
# Use as iterator
partition_iter = iter(partition)
another_block = next(parititon_iter)
the_second_block = next(parititon_iter)