Beispiel #1
0
 def add_node(self, u):
     Graph.add_node(self, u)
     self.vertexRecords.extend(
         [None for x in range(len(vertexRecords), u + 1)])
     self.vertexRecords[u] = VertexInfo(parent=None,
                                        children=[],
                                        depth=None)
Beispiel #2
0
def read_gml(filename):
    graph = Graph()

    data = read_gml_data(filename)
    for n in data['graph']['node']:
        graph.add_node(int(n['id']))

    for e in data['graph']['edge']:
        graph.add_edge(int(e['source']), int(e['target']))

    return graph
def read_gml(filename):
    graph = Graph()

    data = read_gml_data(filename)
    for n in data['graph']['node']:
        graph.add_node(int(n['id']))

    for e in data['graph']['edge']:
        graph.add_edge(int(e['source']), int(e['target']))

    return graph
Beispiel #4
0
def read_gml(filename):
    graph = Graph()

    data = read_gml_data(filename)
    for n in data["graph"]["node"]:
        graph.add_node(int(n["id"]))

    for e in data["graph"]["edge"]:
        graph.add_edge(int(e["source"]), int(e["target"]))

    return graph
Beispiel #5
0
 def add_node(self, u):
     Graph.add_node(self, u)
     self.vertexRecords.extend([None for x in range(len(vertexRecords), u + 1)])
     self.vertexRecords[u] = VertexInfo(parent=None, children=[],
                                        depth=None)