is_aperiodic

Contents

is_aperiodic#

graph_tool.structure.is_aperiodic(g)[git][source]#

Check whether a strongly connected directed graph is aperiodic.

Parameters:
gGraph

Strongly connected directed graph.

Returns:
aperiodicbool

True if the greatest common divisor of the cycle lengths is one.

See also

label_components

Strongly connected components

is_DAG

Test for directed acyclic graphs

Notes

A random walk on a strongly connected graph converges to its stationary distribution if and only if the graph is aperiodic. With the breadth-first levels \(l\) from any vertex, the greatest common divisor of the cycle lengths equals that of \(l(u) + 1 - l(v)\) over the edges \((u, v)\) [jarvis-graph-1996], which is computed in time \(O(V + E)\). A ValueError is raised if the graph is not strongly connected.

References

[jarvis-graph-1996]

J. P. Jarvis and D. R. Shier, “Graph-theoretic analysis of finite Markov chains”, in Applied Mathematical Modeling: A Multidisciplinary Approach, CRC Press (1996).

Examples

>>> print(gt.is_aperiodic(gt.circular_graph(4, directed=True)))
False
>>> g = gt.circular_graph(4, directed=True)
>>> g.add_edge(0, 2)
<...>
>>> print(gt.is_aperiodic(g))
True