0

I was wondering whether anyone used the drawing capabilities of graph-tool and ran into the issue of overlapping nodes after calculating layout in various ways?

On the same note, did anyone find a solution for increasing the size of some of the nodes, say based on their degree, and ensuring that they won't then overlap with other nodes?

Xcodian Solangi
  • 2,342
  • 5
  • 24
  • 52
Ilyco
  • 1
  • 2

1 Answers1

0

For the variable size of the degree, you can define a node property in the graph for that. If you have a dictionary containing the degree for instance, you can do:

import graph_tool as gt
from graph_tool.draw import sfdp_layout,graph_draw

G = gt.Graph(directed=False)
v_size = G.new_vertex_property("int")
for n in nodes:
  v = G.add_vertex()
  v_size[v] = degree[n]
  pos = sfdp_layout(G)
  graph_draw(G0,pos,
    vertex_size=v_size,
    output="graph.png"
  )

Hope that helps.

Luffy
  • 31
  • 4