network_topology

Contents

network_topology#

class braintools.visualize.network_topology(adjacency, positions=None, node_colors=None, edge_colors=None, node_sizes=None, edge_widths=None, ax=None, figsize=(10, 10), layout='spring', title=None, **kwargs)#

Visualize network topology from adjacency matrix.

Parameters:
  • adjacency (ndarray) – Adjacency or signed weight matrix of the network; adjacency[i, j] is the edge from node i to node j. Every non-zero entry is drawn as a line (edge direction is not shown). Without edge_colors, positive edges are gray and negative (e.g. inhibitory) edges blue.

  • positions (ndarray | None) – Node positions (N, 2). If None, uses layout algorithm.

  • node_colors (str | ndarray | None) – Colors for nodes.

  • edge_colors (ndarray | None) – Colors for edges: a single color, one color per drawn edge (in row-major order of the adjacency matrix), or an (N, N) / flattened N*N array indexed like adjacency.

  • node_sizes (float | ndarray | None) – Sizes for nodes.

  • edge_widths (float | ndarray | None) – Widths for edges, in the same formats as edge_colors; an (N, N) weight matrix can be passed directly (its absolute values are used).

  • ax (Axes | None) – Axes to plot on.

  • figsize (Tuple[float, float]) – Figure size if creating new figure.

  • layout (str) – Layout algorithm: ‘spring’, ‘circular’, ‘random’.

  • title (str | None) – Plot title.

  • **kwargs – Additional arguments passed to scatter (for nodes).

Returns:

ax – The axes object containing the plot.

Return type:

Axes

See also

braintools.visualize.morphology.plot_topology_graph

Draw a discrete neuron topology (branches, control volumes, solver nodes) as a graph.