def read_hypergraph(string):
hgr = hypergraph()<EOL>dom = parseString(string)<EOL>for each_node in dom.getElementsByTagName("<STR_LIT>"):<EOL><INDENT>hgr.add_node(each_node.getAttribute('<STR_LIT:id>'))<EOL><DEDENT>for each_node in dom.getElementsByTagName("<STR_LIT>"):<EOL><INDENT>hgr.add_hyperedge(each_node.getAttribute('<STR_LIT:id>'))<EOL><DEDENT>dom = parseString(string)<EOL>for each_node in dom.getElementsByTagName("<STR_LIT>"):<EOL><INDENT>for each_edge in each_node.getElementsByTagName("<STR_LIT>"):<EOL><INDENT>hgr.link(str(each_node.getAttribute('<STR_LIT:id>')), str(each_edge.getAttribute('<STR_LIT:to>')))<EOL><DEDENT><DEDENT>return hgr<EOL>
Read a graph from a XML document. Nodes and hyperedges specified in the input will be added
to the current graph.

@type  string: string
@param string: Input string in XML format specifying a graph.

@rtype: hypergraph
@return: Hypergraph