Skip to content

num::graph_distance_levels

Defined in header <linear/graph/levels.hpp>

array<idx> graph_distance_levels(const spmat &A, view<const idx> seeds);  // (1)

array<idx> graph_distance_levels(const spmat &A, idx seed);  // (2)

(1) Label each row by its graph distance from the seeds: \(\ell_i = d(i, \mathrm{seeds})\). Grouping by level makes \(A\) block tridiagonal. Empty seeds starts each component at its lowest row.

(2) Label each row by its graph distance from one seed: \(\ell_i = d(i, s)\).

Exceptions

  • std::invalid_argument: If A is not square or a seed is out of range.