Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.generators.joint_degree_seq.is_valid_joint_degree

is_valid_joint_degree(joint_degrees)[source]

Checks whether the given joint degree dictionary is realizable.

A joint degree dictionary is a dictionary of dictionaries, in which entry joint_degrees[k][l] is an integer representing the number of edges joining nodes of degree k with nodes of degree l. Such a dictionary is realizable as a simple graph if and only if the following conditions are satisfied.

  • each entry must be an integer,

  • the total number of nodes of degree k, computed by sum(joint_degrees[k].values()) / k, must be an integer,

  • the total number of edges joining nodes of degree k with nodes of degree l cannot exceed the total number of possible edges,

  • each diagonal entry joint_degrees[k][k] must be even (this is a convention assumed by the joint_degree_graph() function).

Parameters

joint_degrees (dictionary of dictionary of integers) – A joint degree dictionary in which entry joint_degrees[k][l] is the number of edges joining nodes of degree k with nodes of degree l.

Returns

Whether the given joint degree dictionary is realizable as a simple graph.

Return type

bool

References

1

M. Gjoka, M. Kurant, A. Markopoulou, “2.5K Graphs: from Sampling to Generation”, IEEE Infocom, 2013.

2

I. Stanton, A. Pinar, “Constructing and sampling graphs with a prescribed joint degree distribution”, Journal of Experimental Algorithmics, 2012.