brainconn.distance.breadth

breadth(CIJ, source)[source]

Implementation of breadth-first search.

Parameters:
  • CIJ (NxN numpy.ndarray) – binary directed/undirected connection matrix
  • source (int) – source vertex
Returns:

  • distance (Nx1 numpy.ndarray) – vector of distances between source and ith vertex (0 for source)
  • branch (Nx1 numpy.ndarray) – vertex that precedes i in the breadth-first search (-1 for source)

Notes

Breadth-first search tree does not contain all paths (or all shortest paths), but allows the determination of at least one path with minimum distance. The entire graph is explored, starting from source vertex ‘source’.