graph_tool.inference.nested_partition_clear_null#
- graph_tool.inference.nested_partition_clear_null(x)[source]#
Returns a copy of nested partition
xwhere the null values-1are replaced with0.- Parameters:
- xiterable of iterables of
intvalues Partition.
- xiterable of iterables of
- Returns:
- ylist of
numpy.ndarray Nested partition with null values removed.
- ylist of
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)]