Skip to main content
better pic
Source Link
DavidC
  • 16.8k
  • 1
  • 42
  • 94

I interpreted the problem as requiring two different colors if the edges were duplicated:

normal[{x_, y_}] := 0.03*{-y, x}/Norm[{x, y}];
GraphPlot[{1 -> 2, 3 -> 4, 1 -> 3, 2 -> 4, 1 -> 2, 3 -> 4}, 
  VertexLabeling -> True, 
  EdgeRenderingFunction -> (If[Length[#1] > 2, 
  norm = normal[First[#1] - Last[#1]]; {Red, 
  Arrow[{First[#1] + norm, Last[#1] + norm}], .08], Blue, 
  Arrow[{First[#1] - norm, Last[#1] - norm}], .08]}, Arrow[#1]]
  Arrow[#1, .08]] &)]

graphenter image description here

I interpreted the problem as requiring two different colors if the edges were duplicated:

normal[{x_, y_}] := 0.03*{-y, x}/Norm[{x, y}];
GraphPlot[{1 -> 2, 3 -> 4, 1 -> 3, 2 -> 4, 1 -> 2, 3 -> 4}, 
VertexLabeling -> True, 
EdgeRenderingFunction -> (If[Length[#1] > 2, 
 norm = normal[First[#1] - Last[#1]]; {Red, 
  Arrow[{First[#1] + norm, Last[#1] + norm}], Blue, 
  Arrow[{First[#1] - norm, Last[#1] - norm}]}, Arrow[#1]] &)]

graph

I interpreted the problem as requiring two different colors if the edges were duplicated:

normal[{x_, y_}] := 0.03*{-y, x}/Norm[{x, y}];
GraphPlot[{1 -> 2, 3 -> 4, 1 -> 3, 2 -> 4, 1 -> 2, 3 -> 4}, 
  VertexLabeling -> True, 
  EdgeRenderingFunction -> (If[Length[#1] > 2, 
  norm = normal[First[#1] - Last[#1]]; {Red, 
  Arrow[{First[#1] + norm, Last[#1] + norm}, .08], Blue, 
  Arrow[{First[#1] - norm, Last[#1] - norm}, .08]}, 
  Arrow[#1, .08]] &)]

enter image description here

Source Link
DavidC
  • 16.8k
  • 1
  • 42
  • 94

I interpreted the problem as requiring two different colors if the edges were duplicated:

normal[{x_, y_}] := 0.03*{-y, x}/Norm[{x, y}];
GraphPlot[{1 -> 2, 3 -> 4, 1 -> 3, 2 -> 4, 1 -> 2, 3 -> 4}, 
VertexLabeling -> True, 
EdgeRenderingFunction -> (If[Length[#1] > 2, 
 norm = normal[First[#1] - Last[#1]]; {Red, 
  Arrow[{First[#1] + norm, Last[#1] + norm}], Blue, 
  Arrow[{First[#1] - norm, Last[#1] - norm}]}, Arrow[#1]] &)]

graph