module graph.graphviz_helper

Short summary

module mlstatpy.graph.graphviz_helper

graphviz helper

source on GitHub

Functions

function

truncated documentation

draw_graph_graphviz

Draw a graph using Graphviz.

edges2gv

Converts a graph into a graphviz file format.

run_graphviz

Run GraphViz.

Documentation

graphviz helper

source on GitHub

mlstatpy.graph.graphviz_helper.draw_graph_graphviz(vertices, edges, image, engine='dot')[source]

Draw a graph using Graphviz.

Paramètres
  • edges – see below

  • vertices – see below

  • image – output image

  • enginedot or neato

Renvoie

Graphviz

The function creates a file <image>.gv.

edges    = [ (1,2, label, color), (3,4), (1,3), ... ]  , liste d'arcs
vertices = [ (1, label, color), (2), ... ]  , liste de noeuds
image = nom d'image (format png)

source on GitHub

mlstatpy.graph.graphviz_helper.edges2gv(vertices, edges)[source]

Converts a graph into a graphviz file format.

Paramètres
  • edges – see below

  • vertices – see below

Renvoie

gv format

The function creates a file <image>.gv.

<<<

from mlstatpy.graph.graphviz_helper import edges2gv
gv = edges2gv([(1, "eee", "red")],
              [(1, 2, "blue"), (3, 4), (1, 3)])
print(gv)

>>>

    digraph{
    "1" [label="eee",fillcolor=red,color=red];
    2 ;
    3 ;
    4 ;
    "1" -> "2" [label="blue"];
    "3" -> "4";
    "1" -> "3";
    }

source on GitHub

mlstatpy.graph.graphviz_helper.run_graphviz(filename, image, engine='dot')[source]

Run GraphViz.

Paramètres
  • filename – filename which contains the graph definition

  • image – output image

  • enginedot or neato

Renvoie

output of graphviz

source on GitHub