spacenet.pcf.helpers.is_connected_filter#

spacenet.pcf.helpers.is_connected_filter(network, nodes_A, nodes_B, filter_largest_connected=False)#

A helper function to check if the network is connected and filter to the largest connected component if not. This is important for the netPCF as it is only defined for connected graphs. If the network is not connected, we can either filter to the largest connected component or raise an error.

Parameters:
networknetworkx.Graph

The input network on which the correlation function will be computed.

nodes_Anumpy.ndarray

An array of node indices corresponding to the first population of interest.

nodes_Bnumpy.ndarray

An array of node indices corresponding to the second population of interest.

filter_largest_connectedbool, optional

If True, if the network is not connected, the largest connected component will be extracted for analysis. If False, a RuntimeError will be raised if the network is not connected. Default is False.

Returns:
networknetworkx.Graph

The (possibly filtered) network that will be used for analysis.

nodes_Anumpy.ndarray

The (possibly filtered) array of node indices for the first population of interest.

nodes_Bnumpy.ndarray

The (possibly filtered) array of node indices for the second population of interest.