(string)
return hgr
Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
    added to the current hypergraph.
    
    @type  string: string
    @param string: Input string in dot format specifying a graph.
    
    @rtype:  hypergraph
    @return: Hypergraph
Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
    added to the current hypergraph.
Read a hypergraph from a string in dot format . Nodes and edges specified in the input will be added to the current hypergraph .
def read_hypergraph(string):
    """
    Read a hypergraph from a string in dot format. Nodes and edges specified in the input will be
    added to the current hypergraph.
    
    @type  string: string
    @param string: Input string in dot format specifying a graph.
    
    @rtype:  hypergraph
    @return: Hypergraph
    """
    hgr = hypergraph()
    dotG = pydot.graph_from_dot_data(string)
    
    # Read the hypernode nodes...
    # Note 1: We need to assume that all of the nodes are listed since we need to know if they
    #           are a hyperedge or a normal node
    # Note 2: We should read in all of the nodes before putting in the links
    for each_node in dotG.get_nodes():
        if 'hypernode' == each_node.get('hyper_node_type'):
            hgr.add_node(each_node.get_name())
        elif 'hyperedge' == each_node.get('hyper_node_type'):
            hgr.add_hyperedge(each_node.get_name())
    
    # Now read in the links to connect the hyperedges
    for each_link in dotG.get_edges():
        if hgr.has_node(each_link.get_source()):
            link_hypernode = each_link.get_source()
            link_hyperedge = each_link.get_destination()
        elif hgr.has_node(each_link.get_destination()):
            link_hypernode = each_link.get_destination()
            link_hyperedge = each_link.get_source()
        hgr.link(link_hypernode, link_hyperedge)
    
    return hgr
def read_hypergraph ( string ) : hgr = hypergraph ( ) dotG = pydot . graph_from_dot_data ( string ) # Read the hypernode nodes... # Note 1: We need to assume that all of the nodes are listed since we need to know if they #           are a hyperedge or a normal node # Note 2: We should read in all of the nodes before putting in the links for each_node in dotG . get_nodes ( ) : if 'hypernode' == each_node . get ( 'hyper_node_type' ) : hgr . add_node ( each_node . get_name ( ) ) elif 'hyperedge' == each_node . get ( 'hyper_node_type' ) : hgr . add_hyperedge ( each_node . get_name ( ) ) # Now read in the links to connect the hyperedges for each_link in dotG . get_edges ( ) : if hgr . has_node ( each_link . get_source ( ) ) : link_hypernode = each_link . get_source ( ) link_hyperedge = each_link . get_destination ( ) elif hgr . has_node ( each_link . get_destination ( ) ) : link_hypernode = each_link . get_destination ( ) link_hyperedge = each_link . get_source ( ) hgr . link ( link_hypernode , link_hyperedge ) return hgr