Package pygraph :: Package readwrite :: Module dot

Module dot

Functions for reading and writing graphs in Dot language.

Functions
graph
read(string)
Read a graph from a string in Dot language and return it.
hypergraph
read_hypergraph(string)
Read a hypergraph from a string in dot format.
string
write(G, weighted=False)
Return a string specifying the given graph in Dot language.
string
write_hypergraph(hgr, colored=False)
Return a string specifying the given hypergraph in DOT Language.
Variables
  colors = ['aquamarine4', 'blue4', 'brown4', 'cornflowerblue', ...
  __package__ = 'pygraph.readwrite'
Function Details

read(string)

 

Read a graph from a string in Dot language and return it. Nodes and edges specified in the input will be added to the current graph.

Parameters:
  • string (string) - Input string in Dot format specifying a graph.
Returns: graph
Graph

read_hypergraph(string)

 

Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be added to the current hypergraph.

Parameters:
  • string (string) - Input string in dot format specifying a graph.
Returns: hypergraph
Hypergraph

write(G, weighted=False)

 

Return a string specifying the given graph in Dot language.

Parameters:
  • G (graph) - Graph.
  • weighted (boolean) - Whether edges should be labelled with their weight.
Returns: string
String specifying the graph in Dot Language.

write_hypergraph(hgr, colored=False)

 

Return a string specifying the given hypergraph in DOT Language.

Parameters:
  • hgr (hypergraph) - Hypergraph.
  • colored (boolean) - Whether hyperedges should be colored.
Returns: string
String specifying the hypergraph in DOT Language.

Variables Details

colors

Value:
['aquamarine4',
 'blue4',
 'brown4',
 'cornflowerblue',
 'cyan4',
 'darkgreen',
 'darkorange3',
 'darkorchid4',
...