kth power of a directed 1-graph
g1 = graph_power(g,k)
a graph_data_structure defining a directed graph.
integer
graph data structure of the new graph
graph_power
computes the directed graph g1
which is the kth power
of directed 1-graph g
.
There is an arc between two nodes in g1
if there exists a path between
these nodes of length at most k in g
.
graph_power(g,1)
is graph g
.
If such a graph does not exist, an empty vector is returned.