is_joint_degree_graphical

is_joint_degree_graphical#

graph_tool.generation.is_joint_degree_graphical(jdm, out_deg=None, in_deg=None)[git][source]#

Check whether a joint degree matrix can be realized by a simple graph.

Parameters:
jdmtwo-dimensional numpy.ndarray

Joint degree matrix, where jdm[k, l] is the number of edges between vertices of degrees \(k\) and \(l\) (twice that number for \(k = l\)), or, if out_deg and in_deg are given, the number of edges from vertices of out-degree \(k\) to vertices of in-degree \(l\).

out_degiterable of int (optional, default: None)

Out-degree of every vertex, for directed graphs.

in_degiterable of int (optional, default: None)

In-degree of every vertex, for directed graphs.

Returns:
is_graphicalbool

True if the joint degrees can be realized by a simple graph.

See also

generate_joint_degree

Realization of joint degree matrices

is_graphical

Test for degree sequences

Notes

In the undirected case [stanton-constructing-2012], the matrix \(J\) must be square and symmetric with nonnegative integer entries, with \(J_{0l} = 0\) for all \(l\); the number of vertices of degree \(k \ge 1\), \(n_k = \sum_l J_{kl}/k\), must be an integer; and

\[J_{kl} \le n_kn_l \quad (k\ne l), \qquad J_{kk} \le n_k(n_k-1), \quad J_{kk} \text{ even}.\]

These conditions are necessary and sufficient. In the directed case [gjoka-construction-2015], with \(n^+_k\) vertices of out-degree \(k\), \(n^-_l\) vertices of in-degree \(l\), and \(n_{kl}\) vertices with both, as given by out_deg and in_deg, the conditions are \(J_{k0} = J_{0l} = 0\),

\[\sum_lJ_{kl} = kn^+_k, \qquad \sum_kJ_{kl} = ln^-_l, \qquad J_{kl} \le n^+_kn^-_l - n_{kl},\]

where the last bound is the number of pairs of distinct vertices of out-degree \(k\) and in-degree \(l\).

References

[stanton-constructing-2012]

Isabelle Stanton and Ali Pinar, “Constructing and sampling graphs with a prescribed joint degree distribution”, ACM Journal of Experimental Algorithmics 17, 3.5 (2012), DOI: 10.1145/2133803.2330086 [sci-hub, @tor], arXiv: 1103.4875

[gjoka-construction-2015]

Minas Gjoka, Balint Tillman and Athina Markopoulou, “Construction of simple graphs with a target joint degree matrix and beyond”, in 2015 IEEE Conference on Computer Communications (INFOCOM), 1553-1561 (2015), DOI: 10.1109/INFOCOM.2015.7218534 [sci-hub, @tor]

Examples

>>> jdm = np.zeros((3, 3), dtype="int")
>>> jdm[1, 2] = jdm[2, 1] = 2
>>> jdm[2, 2] = 2
>>> print(gt.is_joint_degree_graphical(jdm))
True