Hello everybody,
I am trying the following steps:
- Import an initial graph using the load_graph_from_csv
- Plot it assigning a color to every node given a vertex property
- Reduce the original graph to its biggest component
- Plot the biggest component sticking to the same colors for nodes as point 2
- Experiment with seed propagation algorithm to see how this colors change
I am working in parallel with neo4j to run all the algos and reduction to connected components. Starting from a edges.csv that contains 2 columns, “sourceNodeId” and “targetNodeId”, i initially read it, then I use a nodes.csv with “nodeId” and “property” to create a vprop, that I will pass it later to vertex_fill_color. Here the code:
g = graph_tool.load_graph_from_csv('edges.csv'), directed=True, hashed=True, skip_first=True)
nodes_prop = nodes.sort_values(by = "nodeId")
vprop = g.new_vertex_property("int", vals=nodes_prop["property"])
graph_draw(g, vertex_fill_color = vprop)
I then proced to do the same thing as above with a connected component, therefore a edgesCC.cvs with less edges but same id referring to the nodes, and also nodesCC.csv with the same property, but just less nodes.
gCC = graph_tool.load_graph_from_csv('edgesCC.csv'), directed=True, hashed=True, skip_first=True)
nodes_propCC = nodesCC.sort_values(by = "nodeId")
vpropCC = gCC.new_vertex_property("int", vals=nodes_propCC["property"])
graph_draw(gCC, vertex_fill_color = vpropCC)
And at this point I realised that the colors are probably wrongly assigned. Even though we cannot see correspondences from image 1 to 2 in node positions, the colors (I think at least) should be the same. But in the second image, that should be a subgraph of the first image, I cannot find color correspondences. I noticed it particularly in the yellowish cluster that in the first image is basically just a big one on the left with some green, and in the second is on the right, but now there is no green but blue and red instead.
Any hints?
Christian