brainconn.clustering.get_components

get_components(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:
  • A (NxN numpy.ndarray) – binary undirected adjacency matrix
  • no_depend (Any) – Does nothing, included for backwards compatibility
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, matlab code, although the component topology is.

Many thanks to Nick Cullen for providing this implementation