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, 18 Dec 2020 20:59:00 +0100edge label in graph doesn't printhttps://ask.sagemath.org/question/54722/edge-label-in-graph-doesnt-print/ I'm creating triplets from a string to avoid typing all those {}, to create a graph. Although the vertexes label properly, each third element should label an edge, but nothing happens. Otherwise it works. What is missing? Thanks.![image description](/upfiles/16081852304812413.png)
grafadds = []
triplet = "alpha beta ab beta cappa bc cappa delta cd delta gamma dg alpha beta ab gamma alpha ga gamma beta gb beta alpha ba gamma gamma gg".split()
triplet = iter(triplet)
while True:
try:
grafadds.append((next(triplet), next(triplet),next(triplet)))
except StopIteration:
break
G = Graph(multiedges=True,loops=True)
G.add_edges(grafadds)
G.show()Thu, 17 Dec 2020 07:08:05 +0100https://ask.sagemath.org/question/54722/edge-label-in-graph-doesnt-print/Answer by FrédéricC for <p>I'm creating triplets from a string to avoid typing all those {}, to create a graph. Although the vertexes label properly, each third element should label an edge, but nothing happens. Otherwise it works. What is missing? Thanks.<img alt="image description" src="/upfiles/16081852304812413.png"></p>
<pre><code>grafadds = []
triplet = "alpha beta ab beta cappa bc cappa delta cd delta gamma dg alpha beta ab gamma alpha ga gamma beta gb beta alpha ba gamma gamma gg".split()
triplet = iter(triplet)
while True:
try:
grafadds.append((next(triplet), next(triplet),next(triplet)))
except StopIteration:
break
G = Graph(multiedges=True,loops=True)
G.add_edges(grafadds)
G.show()
</code></pre>
https://ask.sagemath.org/question/54722/edge-label-in-graph-doesnt-print/?answer=54723#post-id-54723The documentation says that you need to ask for the edge labels : `G.show(edge_labels=True)`Thu, 17 Dec 2020 08:43:55 +0100https://ask.sagemath.org/question/54722/edge-label-in-graph-doesnt-print/?answer=54723#post-id-54723Comment by cybervigilante for <p>The documentation says that you need to ask for the edge labels : <code>G.show(edge_labels=True)</code></p>
https://ask.sagemath.org/question/54722/edge-label-in-graph-doesnt-print/?comment=54751#post-id-54751Well, that was simple. Thanks. 😀 But for some reason after finding the docs there is nothing on increasing edge length, which is really important in a cluttered graph.Fri, 18 Dec 2020 20:59:00 +0100https://ask.sagemath.org/question/54722/edge-label-in-graph-doesnt-print/?comment=54751#post-id-54751