Simple example using add_edge_list()
edges = [["A", "B", 10], ["A", "C", 10], ["B", "C", 10], ["C", "D", 1], ["B", "F", 1], ["A", "E", 1], ["D", "E", 10], ["D", "F", 10], ["E", "F", 10]]
g = Graph() eweight = g.new_edge_property("int") eprops = [eweight] g.add_edge_list(edges, eprops=eprops, hashed=True)
How do I recover the vertex names ("A", "B", "C", etc), so that after I fit an SBM I can collect membership of vertices?
Now, if I had loaded the same data set from a .csv using load_graph_from_csv() and run this:
g = load_graph_from_csv('edges.csv', hashed = True)
Then the following keep track of both edge weights and vertex names:
weights = g.edge_properties['c1'] vnames = g.vertex_properties
However, if I fit an SBM to g using edge weights using this method, I get an error message:
AttributeError: 'str' object has no attribute 'key_type'
-- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/