andrey.viz.classify_edge#
- andrey.viz.classify_edge(mark_i, mark_j, kind)[source]#
Name the edge type from its endpoint-mark pair and the graph kind.
The name selects the edge’s color and mark shapes:
directedis the graphite backbone, and the rest carry the palette’s uncertainty colors.- Parameters:
mark_i (
int) – The endpoint marks at nodesiandj:TAIL,ARROW, orCIRCLEfromandrey.core.structure.mark_j (
int) – The endpoint marks at nodesiandj:TAIL,ARROW, orCIRCLEfromandrey.core.structure.kind (
str) – The graph kind (dag/cpdag/pag/digraph). OnlyARROW/ARROWreads differently across kinds.
- Returns:
"directed"(->),"undirected"(--),"bidirected"(<->outside adigraph),"twocycle"(<->in adigraph: two directed edges), or"partial"(an edge with a circle end:o->,-o, oro-o).- Return type:
- Raises:
ValueError – If a mark is not
TAIL,ARROW, orCIRCLE, orkindis not one of the four kinds.
Notes
ARROW/ARROWis kind-relative: abidirectededge (latent confounder) under a PAG, atwocycle(feedback, two directed edges) under a directed graph. The two are drawn differently on purpose, so a reader never mistakes feedback for a hidden common cause.Examples
>>> from andrey.core.structure import ARROW, TAIL >>> from andrey.viz import classify_edge >>> classify_edge(TAIL, ARROW, "dag") 'directed' >>> classify_edge(ARROW, ARROW, "pag"), classify_edge(ARROW, ARROW, "digraph") ('bidirected', 'twocycle')