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.Wed, 10 Oct 2018 16:32:08 +0200Graph with partial edge labellinghttps://ask.sagemath.org/question/43892/graph-with-partial-edge-labelling/ Hello all,
I need to draw a graph in which some edges are labelled and some edges are not.
I know how to make all the edges labelled. But I need mixed edges (some are labelled and some are not).
Kindly help me with this.
Thank youWed, 10 Oct 2018 09:04:43 +0200https://ask.sagemath.org/question/43892/graph-with-partial-edge-labelling/Comment by rburing for <p>Hello all, </p>
<p>I need to draw a graph in which some edges are labelled and some edges are not.
I know how to make all the edges labelled. But I need mixed edges (some are labelled and some are not).</p>
<p>Kindly help me with this. </p>
<p>Thank you</p>
https://ask.sagemath.org/question/43892/graph-with-partial-edge-labelling/?comment=43895#post-id-43895Maybe label the "unlabeled" by `''` (the empty string) instead of `None`?Wed, 10 Oct 2018 09:24:58 +0200https://ask.sagemath.org/question/43892/graph-with-partial-edge-labelling/?comment=43895#post-id-43895Answer by tmonteil for <p>Hello all, </p>
<p>I need to draw a graph in which some edges are labelled and some edges are not.
I know how to make all the edges labelled. But I need mixed edges (some are labelled and some are not).</p>
<p>Kindly help me with this. </p>
<p>Thank you</p>
https://ask.sagemath.org/question/43892/graph-with-partial-edge-labelling/?answer=43902#post-id-43902@rburing is right, replacing the `None` label with `''` (the empty string) does the job. If you have a partially labelled graph `G`, and want to replace the `None` labels with `''`, you can do the following:
sage: for u,v,l in G.edges():
....: if l is None:
....: G.set_edge_label(u,v,'')Wed, 10 Oct 2018 16:32:08 +0200https://ask.sagemath.org/question/43892/graph-with-partial-edge-labelling/?answer=43902#post-id-43902