Package pygraph :: Package readwrite :: Module markup

Module markup

Functions for reading and writing graphs in a XML markup.

Functions
graph
read(string)
Read a graph from a XML document and return it.
hypergraph
read_hypergraph(string)
Read a graph from a XML document.
string
write(G)
Return a string specifying the given graph as a XML document.
string
write_hypergraph(hgr)
Return a string specifying the given hypergraph as a XML document.
Variables
  __package__ = 'pygraph.readwrite'
Function Details

read(string)

 

Read a graph from a XML document and return it. Nodes and edges specified in the input will be added to the current graph.

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

read_hypergraph(string)

 

Read a graph from a XML document. Nodes and hyperedges specified in the input will be added to the current graph.

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

write(G)

 

Return a string specifying the given graph as a XML document.

Parameters:
  • G (graph) - Graph.
Returns: string
String specifying the graph as a XML document.

write_hypergraph(hgr)

 

Return a string specifying the given hypergraph as a XML document.

Parameters:
  • hgr (hypergraph) - Hypergraph.
Returns: string
String specifying the graph as a XML document.