In any directed bipartite graph, all cycles have a length that is divisible by two. Therefore, no directed bipartite graph can be aperiodic. In any directed acyclic graph, it is a vacuous truth that every k divides all cycles so no directed acyclic graph can be aperiodic. And in any directed cycle graph, there is only one cycle, so every cycle's length is divisible by n, the length of that cycle.
Testing for aperiodicity
Suppose that G is strongly connected and that k divides the lengths of all cycles in G. Consider the results of performing a depth-first search of G, starting at any vertex, and assigning each vertex v to a set Vi where i is the length of the path in the depth-first search tree from the root to v. It can be shown that this partition into sets Vi has the property that each edge in the graph goes from a set Vi to another set V mod k. Conversely, if a partition with this property exists for a strongly connected graphG, k must divide the lengths of all cycles in G. Thus, we may find the period of a strongly connected graphG by the following steps:
Perform a depth-first search of G
For each e in G that connects a vertex on level i of the depth-first search tree to a vertex on level j, letke = j - i - 1.
Compute the greatest common divisor of the set of numbers ke.
The graph is aperiodic if and only if the period computed in this fashion is 1. If G is not strongly connected, we may perform a similar computation in each strongly connected component of G, ignoring the edges that pass from one strongly connected component to another. Jarvis and Shier describe a very similar algorithm using breadth first search in place of depth-first search; the advantage of depth-first search is that the strong connectivity analysis can be incorporated into the same search.
Applications
In a strongly connected graph, if one defines a Markov chain on the vertices, in which the probability of transitioning from v to w is nonzero if and only if there is an edge from v to w, then this chain is aperiodic if and only if the graph is aperiodic. A Markov chain in which all states are recurrent has a strongly connected state transition graph, and the Markov chain is aperiodic if and only if this graph is aperiodic. Thus, aperiodicity of graphs is a useful concept in analyzing the aperiodicity of Markov chains. Aperiodicity is also an important necessary condition for solving the road coloring problem. According to the solution of this problem, a strongly connected directed graph in which all vertices have the same outdegree has a synchronizable edge coloring if and only if it is aperiodic.