This follows on from my previous question answered here.
Ultimately, I now have a graph which I've simplified for posting here:
g1 = Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3,
3 \[UndirectedEdge] 1}, EdgeWeight -> {10, 10, 10},
VertexLabels -> Table[i -> Placed[i, Center], {i, 3}],
VertexLabelStyle -> Directive[White, Bold, 15], VertexSize -> 0.1,
GraphLayout -> {"VertexLayout" -> {"SpringElectricalEmbedding",
"EdgeWeighted" -> True}}]
r0 = {1, 2, 3};
e0 = DirectedEdge @@@ Partition[r0, 2, 1];
r1 = {1, 2, 1};
e1 = DirectedEdge @@@ Partition[r1, 2, 1];
g2 = SetProperty[EdgeAdd[g1, Join[
e0, e1
]], {VertexCoordinates -> GraphEmbedding[g1],
VertexStyle -> {1 -> Red}, EdgeStyle -> {
Alternatives @@ e0 -> {Green, Thick},
Alternatives @@ e1 -> {Blue, Thick}
}}]
Which outputs the following:
Ideally, one of the arrows from v1
to v2
would be green. However, as Mathematica views this edge in e1
as the same as the equivalent edge in e0
, the formatting of the latter defined edge overwrites the e0
edge.
Research into options so far has spanned: (1) using this EdgeShapeFunction technique, which is not working as I believe the syntax isn't handling the collection of edges correctly and (2) looking into constructing custom sub DirectedEdge type objects to trick Mathematica into thinking they were different, which I don't believe is possible given my layman's understanding of the software.