I'm digging into graph-tool and I try to build a graph, which shows me the current in and out degrees of my vertices. I checked out the sample from the website, which works fine for me, but as I try to build my own random graph all the vertices show only "1" as vertex text, instead of the real number.
My current code looks like this:
g = Graph()
g.set_directed(False)
N = 50
v = g.add_vertex()
vlist = [v]
for i in range(1, N):
v = g.add_vertex()
i = randint(0, len(vlist))
target = vlist[i]
e = g.add_edge(v, target)
vlist.append(v)
vlist.append(target)
graph_draw(g, output_size=[1000, 1000])
All good so far, but as I calculate the kcore via ...
kcore = kcore_decomposition(g)
... and draw the graph like ...
graph_draw(g, output_size=[1000, 1000], vertex_fill_color=kcore,
vertex_text=kcore)
.. the result is the following:
Which is really not the right result. If I check for the largest component with the following code:
largest = label_largest_component(g)
print(largest.a)
I will get an list with exact 50 times 1. Do I miss here something?
I reduced the size of the images, only to upload it here with a smaller size than 2MB. So that's why the current size is not 1000x1000 like as mentioned in the code.