(string)
return hgr
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
Read a graph from a XML document. Nodes and hyperedges specified in the input will be added
    to the current graph.
Read a graph from a XML document . Nodes and hyperedges specified in the input will be added to the current graph .
def read_hypergraph(string):
    """
    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
    """
    
    hgr = hypergraph()
    
    dom = parseString(string)
    for each_node in dom.getElementsByTagName("node"):
        hgr.add_node(each_node.getAttribute('id'))
    for each_node in dom.getElementsByTagName("hyperedge"):
        hgr.add_hyperedge(each_node.getAttribute('id'))
    dom = parseString(string)
    for each_node in dom.getElementsByTagName("node"):
        for each_edge in each_node.getElementsByTagName("link"):
            hgr.link(str(each_node.getAttribute('id')), str(each_edge.getAttribute('to')))
    return hgr
def read_hypergraph ( string ) : hgr = hypergraph ( ) dom = parseString ( string ) for each_node in dom . getElementsByTagName ( "node" ) : hgr . add_node ( each_node . getAttribute ( 'id' ) ) for each_node in dom . getElementsByTagName ( "hyperedge" ) : hgr . add_hyperedge ( each_node . getAttribute ( 'id' ) ) dom = parseString ( string ) for each_node in dom . getElementsByTagName ( "node" ) : for each_edge in each_node . getElementsByTagName ( "link" ) : hgr . link ( str ( each_node . getAttribute ( 'id' ) ) , str ( each_edge . getAttribute ( 'to' ) ) ) return hgr