brainconn.clustering.get_components_old

get_components_old(A, no_depend=False)[source]

Returns the components of an undirected graph specified by the binary and undirected adjacency matrix adj. Components and their constitutent nodes are assigned the same index and stored in the vector, comps. The vector, comp_sizes, contains the number of nodes beloning to each component.

Parameters:
  • adj (NxN numpy.ndarray) – binary undirected adjacency matrix
  • no_depend (bool) – If true, doesn’t import networkx to do the calculation. Default value is false.
Returns:

  • comps (Nx1 numpy.ndarray) – vector of component assignments for each node
  • comp_sizes (Mx1 numpy.ndarray) – vector of component sizes

Notes

Note: disconnected nodes will appear as components with a component size of 1

Note: The identity of each component (i.e. its numerical value in the result) is not guaranteed to be identical the value returned in BCT, although the component topology is.

Note: networkx is used to do the computation efficiently. If networkx is not available a breadth-first search that does not depend on networkx is used instead, but this is less efficient. The corresponding BCT function does the computation by computing the Dulmage-Mendelsohn decomposition. I don’t know what a Dulmage-Mendelsohn decomposition is and there doesn’t appear to be a python equivalent. If you think of a way to implement this better, let me know.