is_regular_expander

is_regular_expander#

graph_tool.structure.is_regular_expander(g, epsilon=0)[git][source]#

Check whether a graph is a regular (near-)Ramanujan expander.

Parameters:
gGraph

Undirected graph.

epsilonfloat (optional, default: 0)

Tolerance above the Ramanujan bound.

Returns:
is_expanderbool

True if the graph is \(d\)-regular and the second largest absolute eigenvalue of its adjacency matrix is smaller than \(2\sqrt{d-1} + \epsilon\).

See also

graph_tool.generation.generate_regular_expander

Random regular expanders

Notes

A \(d\)-regular graph whose nontrivial adjacency eigenvalues are bounded in absolute value by \(2\sqrt{d-1}\) is a Ramanujan graph [lubotzky-ramanujan-1988], the best possible spectral expander in the limit of large graphs. If the eigenvalues of the adjacency matrix are ordered as \(|\lambda_1|\ge|\lambda_2|\ge\dots\), so that \(\lambda_1 = d\), the test returns True if all vertices have the same total degree \(d\) and

\[|\lambda_2| < 2\sqrt{d-1} + \epsilon.\]

Hence, disconnected graphs, for which \(\lambda_2 = d\), and bipartite graphs, for which \(\lambda_2 = -d\), never pass the test. The two eigenvalues of largest magnitude are computed with the Lanczos method.

References

[lubotzky-ramanujan-1988]

A. Lubotzky, R. Phillips and P. Sarnak, “Ramanujan graphs”, Combinatorica 8, 261-277 (1988), DOI: 10.1007/BF02126799 [sci-hub, @tor]

Examples

>>> g = gt.complete_graph(10)
>>> print(gt.is_regular_expander(g))
True