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.
string
write(graph)
Return a string specifying the given graph as a XML document.
 
read_hypergraph(hypergraph, string)
Read a graph from a XML document.
string
write_hypergraph(hypergraph)
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

write(graph)

 

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

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

read_hypergraph(hypergraph, string)

 

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

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

write_hypergraph(hypergraph)

 

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

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