Skip to content

VertexInDegree ​

The number of edges of a Graph pointing INTO a vertex.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageVertexInDegree✓
VertexInDegree(g)every vertex's in-degree, in VertexList(g) order.
VertexInDegree(g, v)just v's in-degree.
Typed signatures
TypePackageApplies
(value, any?) -> integer | list<integer>combinatoricsalways

Domain: Collections

Details
  • On a graph with at least one directed edge, undirected edges contribute NOTHING to VertexInDegree (kernel-verified against Wolfram 15): Graph({1->2, 2<->3, 3->1}) gives in-degree {1, 1, 0} -- the undirected 2<->3 edge is invisible here, only the two directed edges count, each at the one endpoint it actually points to.
  • On a graph with NO directed edge at all (purely undirected), VertexInDegree = VertexOutDegree = VertexDegree instead.

Examples

Basic #
live ↗
InVertexInDegree(Graph([1,2,3],[DirectedEdge(1,2),DirectedEdge(3,2)]),2)\mathrm{VertexInDegree}(\mathrm{Graph}(\bigl\lbrack1, 2, 3\bigr\rbrack, \bigl\lbrack\mathrm{DirectedEdge}(1, 2), \mathrm{DirectedEdge}(3, 2)\bigr\rbrack), 2)Out22
live ↗
InVertexInDegree(Graph([1,2,3],[DirectedEdge(1,2),UndirectedEdge(2,3),DirectedEdge(3,1)]))\mathrm{VertexInDegree}(\mathrm{Graph}(\bigl\lbrack1, 2, 3\bigr\rbrack, \bigl\lbrack\mathrm{DirectedEdge}(1, 2), \mathrm{UndirectedEdge}(2, 3), \mathrm{DirectedEdge}(3, 1)\bigr\rbrack))Out[1,1,0]\bigl\lbrack1, 1, 0\bigr\rbrack
About
Examples2
Checked againstWolfram Language 2 agree
CrosswalkWolfram Language

See also: VertexOutDegree, VertexDegree