generate_regular_expander

generate_regular_expander#

graph_tool.generation.generate_regular_expander(N, d, epsilon=0, max_tries=100)[git][source]#

Generate a random regular graph that is a (near-)Ramanujan expander.

Parameters:
Nint

Number of vertices.

dint

Degree, which must be even.

epsilonfloat (optional, default: 0)

Tolerance above the Ramanujan bound (see is_regular_expander()).

max_triesint (optional, default: 100)

Maximum number of attempts.

Returns:
gGraph

The generated undirected \(d\)-regular graph.

See also

graph_tool.structure.is_regular_expander

Spectral test for expanders

generate_k_lift

Random lifts of a graph

random_graph

Random graph with a given degree sequence

Notes

The graph is the union of \(d/2\) uniformly random Hamiltonian cycles, each redrawn until it shares no edge with the previous ones [friedman-proof-2008]. The graph is redrawn until it passes the test of is_regular_expander(); by Friedman’s theorem, random regular graphs are near-Ramanujan with high probability, so that few attempts are needed for \(\epsilon > 0\). A ValueError is raised if max_tries attempts fail.

References

[friedman-proof-2008]

Joel Friedman, “A proof of Alon’s second eigenvalue conjecture and related problems”, Memoirs of the American Mathematical Society 195, 910 (2008), DOI: 10.1090/memo/0910 [sci-hub, @tor], arXiv: cs/0405020

Examples

>>> g = gt.generate_regular_expander(1000, 4, epsilon=0.1)
>>> print(gt.is_regular_expander(g, epsilon=0.1))
True

A smaller instance is drawn as follows:

>>> g = gt.generate_regular_expander(30, 4, epsilon=0.5)
>>> gt.graph_draw(g, pos=gt.sfdp_layout(g),
...               output="generate_regular_expander-small.pdf")
<...>
../_images/generate_regular_expander-small.png

Random 4-regular near-Ramanujan graph with \(N=30\) and \(\epsilon=0.5\).#