CPDAG.toDot

CPDAG.toDot(*args)

The chain components (nodes linked by undirected edges) are drawn in clusters (color of the key dot.chainComponentBgColor of pyagrum.config) and the compelled arcs with the color of the key dot.compelledArcColor.

Parameters:

options (pyagrum.DotOptions, optional) – what is given to the drawing beyond the look of pyagrum.config (size, label, colors of some nodes and arcs…); a color given for an arc wins over the color of the compelled arcs.

Returns:

a representation of the CPDAG in the DOT format

Return type:

str

Example

import pyagrum as gum

cpdag = gum.CPDAG.fromDAG(gum.fastDAG("A->B->C;D->C"))
dot = cpdag.toDot()
"cluster" in dot  # the chain component {A, B}
# True
print("\n".join(line for line in dot.splitlines() if " -> " in line))
#   1 -> 2 [color="red"];
#   3 -> 2 [color="red"];
#   0 -> 1 [dir="none"];

Class

CPDAG

Overridden in

EssentialGraph.toDot