Revision history [back]

Plotting Grid Graph

I'm trying to plot a grid graph, specifying exactly where vertices should be plotted. (I want the plot to look like an actual grid and later overlay a graphics object on it.) The following code gives a KeyError:

G=graphs.GridGraph([8,12])
pos_list=[(i,j) for i in range(8) for j in range(12)]
pos_dict={}
for i in range(len(pos_list)):
pos_dict[i]=pos_list[i]
G.show(pos=pos_dict)


How can I get my plot to look like a regular grid?

 2 retagged FrédéricC 4131 ●3 ●37 ●85

Plotting Grid Graph

I'm trying to plot a grid graph, specifying exactly where vertices should be plotted. (I want the plot to look like an actual grid and later overlay a graphics object on it.) The following code gives a KeyError:

G=graphs.GridGraph([8,12])
pos_list=[(i,j) for i in range(8) for j in range(12)]
pos_dict={}
for i in range(len(pos_list)):
pos_dict[i]=pos_list[i]
G.show(pos=pos_dict)


How can I get my plot to look like a regular grid?