# Label duplicate edges differently?

Posted 10 months ago
1243 Views
|
2 Replies
|
0 Total Likes
|
 I have a Graph with multiple edges between two vertices. Of course, I want to label them differently. (Or, more generally, give them different properties such as weight or style).Unfortunately, WL seems to treat multiple edges just like one edge. They get all the same labels. I cannot use EdgeLabels->{(from->to)->lbl, ...} since this doesn't distinguish between multiple edges. But even if I use Labeled[from->to,lbl] during the definition of the graph's edges, multiple edges do not get different labels. See the following labels with two edges 1->2. hey get the same label, namely the first set. Graph[{ Labeled[1 \[DirectedEdge] 2, "First 1\[DirectedEdge]2"], 1 \[DirectedEdge] 3, Labeled[1 \[DirectedEdge] 2, "Second 1\[DirectedEdge]2"], 3 \[DirectedEdge] 2, 3 \[DirectedEdge] 1} , VertexLabels -> {1 -> "#1", 2 -> "#2", 3 -> "#3"} , EdgeLabels -> "Name", ImageSize -> Small] 
2 Replies
Sort By:
Posted 10 months ago
 This is actively being developed and will show up in version 12.1. At the moment the same edges can not be distinguished unfortunately. @Szabolcs Horvát might know a workaroundNote: Not a Wolfram employee but I only know from what I've seen in the live streams
 I will try to insert additional artificial vertices into each of those multiple edges. This will of course change some properties of the graph, but I need it for visualization and some path calculations only. So this might be a workaround. LayeredGraphPlot[{ Labeled[1 \[DirectedEdge] 21, "First 1\[DirectedEdge]2"], 21 \[DirectedEdge] 2, 1 \[DirectedEdge] 3, Labeled[1 \[DirectedEdge] 22, "Second 1\[DirectedEdge]2"], 22 \[DirectedEdge] 2, 3 \[DirectedEdge] 2, 3 \[DirectedEdge] 1} , VertexLabels -> {1 -> "#1", 2 -> "#2", 3 -> "#3"} , EdgeLabels -> "Name", ImageSize -> Medium]