CPDAG.saveGUMstring

CPDAG.saveGUMstring(indent=None)

Save the graph as a jgum string (see pyagrum.graphFromGUMString to read it back).

Parameters:

indent (int, optional) – JSON indentation: -1 for the most compact output, N>=0 to pretty-print with N spaces. Defaults to pyagrum.config["core","jgumIndent"].

Returns:

the jgum string

Return type:

str

Example

import pyagrum as gum

cpdag = gum.CPDAG.fromDAG(gum.fastDAG("A->B->C;D->C"))
print(cpdag.saveGUMstring(indent=-1))
# {"type":"CPDAG","GumJsonVersion":"1.1","nodes":[0,1,2,3],"names":{"0":"A","1":"B","2":"C","3":"D"},"arcs":[[1,2],[3,2]],"edges":[[0,1]],"markedEdges":[]}

Class

CPDAG

Overridden in

EssentialGraph.saveGUMstring