Ask Your Question
0

How to plot generic graphs without nodes overlapping

asked 2012-04-03 13:34:59 -0600

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?

edit retag flag offensive close merge delete

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 ( 2012-04-03 16:03:39 -0600 )edit

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 ( 2012-04-03 18:17:08 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-04-04 02:32:34 -0600

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.

edit flag offensive delete link more

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: 2012-04-03 13:34:59 -0600

Seen: 1,108 times

Last updated: Apr 04 '12