nested_partition_clear_null

nested_partition_clear_null#

graph_tool.inference.nested_partition_clear_null(x)[source]#

Returns a copy of nested partition x where the null values -1 are replaced with 0.

Parameters:
xiterable of iterables of int values or list of PropertyMap

Partition.

Returns:
ylist of numpy.ndarray

Nested partition with null values removed.

Notes

This is useful to pass hierarchical partitions to NestedBlockState.

Examples

>>> x = [[5, 5, 2, 0, 1, 0, 1, 0, 0, 0, 0], [0, 1, 0, -1, -1, 1]]
>>> gt.nested_partition_clear_null(x)
[array([5, 5, 2, 0, 1, 0, 1, 0, 0, 0, 0], dtype=int32), array([0, 1, 0, 0, 0, 1], dtype=int32)]