graph.degeneracyOrdering
- pyagrum.graph.degeneracyOrdering(g)
A degeneracy (smallest-last) ordering of a graph with arcs and edges (family AE), whatever their orientation.
Every node has at most d connections (arcs and edges) with the nodes before it in the ordering, where d is the smallest such bound. Two nodes connected twice (
x->yandy->x, orx->yandx-y) count as two connections, so that d may exceed the degeneracy of the skeleton. When two nodes are never connected twice (a PDAG, a CPDAG…), d is the degeneracy of the skeleton.- Parameters:
g (
MixedGraph | PDAG | ChainGraph | CPDAG | MPDAG | EssentialGraph) – the graph- Returns:
the nodes in a degeneracy ordering
- Return type:
list[int]
References
D. W. Matula, L. L. Beck. Smallest-last ordering and clustering and graph coloring algorithms. Journal of the ACM 30(3):417-427, 1983.
Example
import pyagrum as gum
import pyagrum.graph as gg
order = gg.degeneracyOrdering(gum.fastMixedGraph("A-B-C-A;C->D"))
sorted(order)
# [0, 1, 2, 3]