GraphPower - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


GraphTheory

  

GraphPower

  

construct graph power of a graph

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

GraphPower(G, k)

Parameters

G

-

unweighted graph

k

-

positive integer

Description

• 

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.

Examples

> 

with⁡GraphTheory:

> 

P≔PathGraph⁡5

P≔Graph 1: an undirected graph with 5 vertices and 4 edges

(1)
> 

Edges⁡P

1,2,2,3,3,4,4,5

(2)
> 

DrawGraph⁡P,style=circle

> 

P2≔GraphPower⁡P,2

P2≔Graph 2: an undirected graph with 5 vertices and 7 edges

(3)
> 

Edges⁡P2

1,2,1,3,2,3,2,4,3,4,3,5,4,5

(4)
> 

DrawGraph⁡P2

> 

P3≔GraphPower⁡P,3

P3≔Graph 3: an undirected graph with 5 vertices and 9 edges

(5)
> 

Edges⁡P3

1,2,1,3,1,4,2,3,2,4,2,5,3,4,3,5,4,5

(6)
> 

DrawGraph⁡P3

See Also

AdjacencyMatrix

Diameter

ShortestPath