# graphPower -- constructs a graph raised to a power

## Synopsis

• Usage:
G' = graphPower(G,k)
• Inputs:
• Outputs:
• G', an instance of the type Graph, graph G to the kth power

## Description

G^k is the graph with the same vertices as G, where the vertices of G^k are adjacent if they are separated by distance less than or equal to k in graph G. If the diameter of G is d, G^d is the complete graph with the same number of vertices as G.

 i1 : G = cycleGraph 6; i2 : graphPower(G,2) o2 = Graph{0 => {1, 2, 4, 5}} 1 => {0, 2, 3, 5} 2 => {0, 1, 3, 4} 3 => {1, 2, 4, 5} 4 => {0, 2, 3, 5} 5 => {0, 1, 3, 4} o2 : Graph