I am working on a project that needs the graph image generated by sage to save to disk then that would be retrieved in the application. Here is the code I am writing for generating a Graph
G=Graph({'a': {'c': 25, 'b': 26, 'e': 30, 'd': 35}, 'c': {'a': 25, 'b': 33, 'e':
27, 'd': 7}, 'b': {'a': 26, 'c': 33, 'e': 34, 'd': 7}, 'e': {'a': 30,
'c': 27, 'b': 34, 'd': 9}, 'd': {'a': 35, 'c': 7, 'b': 7, 'e': 9}})
G.weighted(True)
E = kruskal(G, check=True)
print E
tot=[]
kcost=0;totcost=0
for key in E:
tot.append((key[0],key[1]))
kcost=kcost+key[2]
rev=tot[::-1]
for key in rev:
tot.append((key[1],key[0]))
path=[]
tot1=[]
for key in E:
tot1.append((key[0],key[1]))
tot1.append((key[0],key[1]))
kcost=kcost+key[2]
for p in tot1:
if p[0] not in path:
path.append(p[0])
if p[1] not in path:
path.append(p[1])
print path
print tot1
kcost=totcost/2
print tot,totcost,kcost
N=Graph(E)
N.show()
N1=Graph(tot1)
N1.show()
N.show() and N1.show() will show the Graph describing Now I am facing error running the file and generating image and my image viewer gives me error as in this post of your Google + community I have posted
https://plus.google.com/u/0/113942220708315173370/posts/jScisbFzeDr
So I am Planning to save the image at my selected location and fetch the image from that Position. for that I am using in my code and unsure where to supply a or how to save it Please suggest me how should I save the Images from show() method. I am using Python2.7 does it require some additional package of sagemath.
N1=Graph(tot)
a=N1.show()
newimage=Image.new("RGB",(500,500),"white")
newimage.load()
newimage.save("out.png")