construct graph power of a graph
GraphPower returns the kth graph power of a given graph. This is a graph in which two vertices are connected if there exists a path of length at most k in the original graph.
The input graph G may be directed or undirected.
The algorithm adds powers of the adjacency matrix of G and removes any multiple edges.
P ≔ PathGraph⁡5
P≔Graph 1: an undirected graph with 5 vertices and 4 edge(s)
P2 ≔ GraphPower⁡P,2
P2≔Graph 2: an undirected graph with 5 vertices and 7 edge(s)
P3 ≔ GraphPower⁡P,3
P3≔Graph 3: an undirected graph with 5 vertices and 9 edge(s)
Download Help Document