ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 30 Nov 2016 11:29:51 -0600Does there exist a GUI web-app that allows for edge contractions and vertex splits?https://ask.sagemath.org/question/35825/does-there-exist-a-gui-web-app-that-allows-for-edge-contractions-and-vertex-splits/I am interested in creating a web-app that allows for graph creation, edge contraction, vertex splits, and then exports to sage.
If anyone knows of something like this already developed please let me know, otherwise any suggestions on how to begin?
ThanksfieldofnodesWed, 30 Nov 2016 11:29:51 -0600https://ask.sagemath.org/question/35825/How to make pygraphviz and sage compatible?https://ask.sagemath.org/question/31070/how-to-make-pygraphviz-and-sage-compatible/ Hi,
I would like sage to help me when I am working with (un)directed graphs and quivers, and so on. After having played around with various possibilities, I would like to convert some stuff into a string and then let sage print something like a .ps - file that contains an image from dot (or something similar to this).
> Unfortunately, I came across the following issue(s) and have no idea what to do now. With the sage version I installed, there is python 2.x as a delivered package. But it seems that sage complains about python3, what doesn't make sense to me.
Could you help me understand and solve the following:
boehmler@boehmler-X55A:~/Schreibtisch/bb/sage-6.9-x86_64-Linux$ ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.9, Release Date: 2015-10-10 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: import networkx as nx
sage: import matplotlib.pyplot as plt
sage: import matplotlib.image as mpimg
sage: from cStringIO import StringIO
sage: g = nx.dodecahedral_graph()
sage: d = nx.to_pydot(g)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-0d33c400a5cf> in <module>()
----> 1 d = nx.to_pydot(g)
AttributeError: 'module' object has no attribute 'to_pydot'
sage: d = nx.to_agraph(g)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-d9254026fb59> in <module>()
----> 1 d = nx.to_agraph(g)
/home/boehmler/Schreibtisch/bb/sage-6.9-x86_64-Linux/local/lib/python/networkx/drawing/nx_agraph.pyc in
to_agraph(N)
132 raise ImportError('requires pygraphviz ',
133 'http://networkx.lanl.gov/pygraphviz ',
--> 134 '(not available for Python3)')
135 directed=N.is_directed()
136 strict=N.number_of_selfloops()==0 and not N.is_multigraph()
ImportError: ('requires pygraphviz ', 'http://networkx.lanl.gov/pygraphviz ', '(not available for Python3)')
sage:
Exiting Sage (CPU time 0m3.33s, Wall time 56m28.80s).
After typing
boehmler@boehmler-X55A:~/Schreibtisch/bb/sage-6.9-x86_64-Linux$ sudo -H pip install pygraphviz
I get the message
Wall -Wstrict-prototypes -fPIC -I/usr/include/graphviz -I/usr/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:130:21: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
# include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-6yZh3l/pygraphviz/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-a6o8Fg-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-6yZh3l/pygraphviz
in the end. I would be grateful for any hints how to solve / fix this.
Thanks for the help!
BernWed, 25 Nov 2015 20:42:50 -0600https://ask.sagemath.org/question/31070/Graph: colored edge labelshttps://ask.sagemath.org/question/25413/graph-colored-edge-labels/I'm trying to plot a graph with labels on the edges as follows:
G = Graph(multiedges=True)
G.add_edges( [(0,1,'a'),(1,2,'b'),(2,3,'c'),(3,4,'b'),(4,0,'a')] )
H = G.plot(edge_labels=True, graph_border=True)
H.show()
Is it possible to color the edge labels, e.g. making the "a" red, "b" blue etc?
herbTue, 06 Jan 2015 13:10:47 -0600https://ask.sagemath.org/question/25413/Drawing a graph - fixing its layouthttps://ask.sagemath.org/question/10675/drawing-a-graph-fixing-its-layout/Hello!
I would like to draw a simple graph $G$ and its complement $\overline{G}.$ I was asked to make the drawing such that it is evident that the drawings are complementary. More precisely I was advised to draw $G$ and $\overline{G}$ such that the coordinates of the vertices of $G$ are the same as the one for $\overline{G}.$
What would be an easy way to accomplish this in Sage?
Thank youJernejWed, 30 Oct 2013 06:29:11 -0500https://ask.sagemath.org/question/10675/Create curved edges in a graphhttps://ask.sagemath.org/question/10081/create-curved-edges-in-a-graph/Hello,
It seems that I am only able to create rectilinear graphs in sage. e.g. $K_{13}$ in two concentric circles:
g = graphs.CompleteGraph(13)
_circle_embedding(g,[0,1,2,3,4,5,6],center=(0,0),radius=6,shift=0)
_circle_embedding(g,[7,8,9,10,11,12],center=(0,0),radius=12,shift=0)
g.show()
I'd like to add an image of what this code produces, but I don't have enough karma.
I want my edges to have curves; something like this [Paley Graph](http://upload.wikimedia.org/wikipedia/commons/thumb/0/05/Paley13.svg/500px-Paley13.svg.png).
Any ideas on how to do this?torrhoThu, 02 May 2013 06:20:32 -0500https://ask.sagemath.org/question/10081/