Ask Your Question
0

How to plot generic graphs without nodes overlapping

asked 13 years ago

araichev gravatar image

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?

Preview: (hide)

Comments

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!

kcrisman gravatar imagekcrisman ( 13 years ago )

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()

araichev gravatar imagearaichev ( 13 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 13 years ago

niles gravatar image

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.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 13 years ago

Seen: 3,886 times

Last updated: Apr 04 '12