ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 09 Jan 2015 13:05:52 +0100Graph edge label: formatting possibilitieshttps://ask.sagemath.org/question/25448/graph-edge-label-formatting-possibilities/I have a graph with like this and would like to format ( e.g. color ) the edge labels more individual. Is it possible for example to make from 'a|b' the 'a' red and 'b' blue? Also different font types ( bold, italic ) etc would be interesting.
G = Graph(multiedges=True)
G.add_edges( [(0,1,'a|b'),(1,2,'c|d'),(2,3,'e|f'),(3,4,'g|h'),(4,0,'i|j')] )
H = G.plot(edge_labels=True, graph_border=True)
H.show()
When I remember correctly, there is (limited) support for TeX-formatting, could this be used somehow to achieve the formatting?herbFri, 09 Jan 2015 13:05:52 +0100https://ask.sagemath.org/question/25448/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 20:10:47 +0100https://ask.sagemath.org/question/25413/How to plot a sparse graph with small cycles ?https://ask.sagemath.org/question/9957/how-to-plot-a-sparse-graph-with-small-cycles/Hello,
I have a sparse graph which have few cycles which moreover are small compared to the size of the graph. In other words, my graph looks like a tree. Is there a better way than the default to plot it ?
My graph is precisely the giant component of an random ErdÃ¶s-Renyi graph with parameter just above 1 as in:
sage: G = graphs.RandomGNP(1000, 1.3 / 1000)
sage: cc = G.connected_components_subgraphs()
sage: giant_comp = cc[0]
On my computer, the default picture has a lot of overlaps:
sage: giant_comp.plot(vertex_labels=False, vertex_size=10)
VincentvdelecroixSat, 30 Mar 2013 10:52:16 +0100https://ask.sagemath.org/question/9957/Coloring edges by their labelshttps://ask.sagemath.org/question/9364/coloring-edges-by-their-labels/I'm trying to understand how to use the color_by_label parameter of the Graph.plot() function to set edge colors depending on various conditions. I cannot seem to get any colors to display other than cyan and red, no matter what I put in the edge labels, and, as in the linked image, I cannot seem to reliably get the colors to go with the labels.
In my example, I was trying to set edge color to blue if either of the vertices of an edge is odd, red otherwise.
(Sorry for the external link -- I apparently need to acquire some karma before I can post it here)
[Screen Shot of sage notebook session and graphics output](http://tinypic.com/r/ou5hxt/6)
version. Sage 5.0.1 on Mac OS X 10.8.1, notebook running in ChromemesriFri, 28 Sep 2012 17:39:41 +0200https://ask.sagemath.org/question/9364/