Package graph :: Module readwrite

Module readwrite

Functions for reading and writing graphs.


Author: Pedro Matiello

License: MIT

Functions
 
read(graph, string, fmt)
Read a graph from a string.
string
write(graph, fmt)
Write the graph to a string.
Function Details

read(graph, string, fmt)

 

Read a graph from a string. Nodes and arrows specified in the input will be added to the current graph.

Parameters:
  • string (string) - Input string specifying a graph.
  • fmt (string) - Input format. Possible formats are:
    1. 'xml' - XML (default)

write(graph, fmt)

 

Write the graph to a string. Depending of the output format, this string can be used by read() to rebuild the graph.

Parameters:
  • graph (graph) - Graph.
  • fmt (string) - Output format. Possible formats are:
    1. 'xml' - XML (default)
    2. 'dot' - DOT Language (for GraphViz)
    3. 'dotwt' - DOT Language with weight information
Returns: string
String specifying the graph.