# How to plot generic graphs without nodes overlapping

Hi all:

Regarding generic graphs (the nodes and edges type), is there a way to plot them without the nodes overlapping? Some node_overlap=False option?

edit retag close merge delete

Our plotting algorithms *should* make the nodes not overlap... but maybe they do for huge graphs? A specific example would help our graph experts debug this. Thanks!

Oh yeah, here's a specific example. I want to plot full n-trees and n=5 is the least value for which i get node overlap. sage: n = 5 sage: node = {} sage: node[''] = [str(x) for x in range(n)] sage: for x in range(n): ... node[str(x)] = [str(x) + str(y) for y in range(n)] ... sage: g = Graph(node) sage: P = g.plot(layout='tree', tree_root='') sage: P.show()

Sort by » oldest newest most voted

You need to adjust the size of the output picture; you can do this with the figsize keyword:

sage: n = 5
sage: node = {}
sage: node[''] = [str(x) for x in range(n)]
sage: for x in range(n):
... node[str(x)] = [str(x) + str(y) for y in range(n)]
...
sage: g = Graph(node)
sage: P = g.plot(layout='tree', tree_root='')
sage: P.show(figsize=[10,10])


For larger graphs, you'll probably need to use an even larger figsize, determined by the number of leaves on the bottom row.

more