lib.notebook.getGraph

pyagrum.lib.notebook.getGraph(gr, size=None)

get an HTML representation of a pydot graph

Parameters:
  • gr (pydot.Dot) – the graph

  • size (float|str) – the size (for graphviz) of the rendered graph

Returns:

the HTML representation of the graph (as a string)

Return type:

str

Example

import pydot as dot

import pyagrum as gum
import pyagrum.lib.notebook as gnb

graph = dot.graph_from_dot_data(gum.fastBN("A->B").toDot())[0]
html = gnb.getGraph(graph)
html.startswith("<svg")
# True