netneurotools.networks.binarize_network

netneurotools.networks.binarize_network(network, retain=10, keep_diag=False)[source]

Keep top retain % of connections in network and binarizes.

Uses the upper triangle for determining connection percentage, which may result in disconnected nodes. If this behavior is not desired see netneurotools.networks.threshold_network().

Parameters:
  • network ((N, N) array_like) – Input graph

  • retain ([0, 100] float, optional) – Percent connections to retain. Default: 10

  • keep_diag (bool, optional) – Whether to keep the diagonal instead of setting it to 0. Default: False

Returns:

binarized – Binarized, thresholded graph

Return type:

(N, N) numpy.ndarray