is_regular#

is_regular(G)[source]#

Determines whether a graph is regular.

A regular graph is a graph where all nodes have the same degree. A regular digraph is a graph where all nodes have the same indegree and all nodes have the same outdegree.

Parameters:
GNetworkX graph
Returns:
bool

Whether the given graph or digraph is regular.

Examples

>>> G = nx.DiGraph([(1, 2), (2, 3), (3, 4), (4, 1)])
>>> nx.is_regular(G)
True
----

Additional backends implement this function

graphblas : OpenMP-enabled sparse linear algebra backend.