Assume there is a set of rules:
set = {"A" -> "B", "B" -> "A", "B" -> "C", "C" -> "D", "D" -> "A", "C" -> "C"};
which we want to graph using LayeredGraphPLot
, and we want to impose the rule that any pair of vertices that have 2 edges going between them, in different directions ("A" -> "B" and "B" -> "A"), that those edges be a different color, style, etc.
Here is my code:
LayeredGraphPlot[set, DirectedEdges -> True, EdgeRenderingFunction -> (If[MemberQ[Reverse /@ set, #] &,
{Black, Thickness[0.01], Arrow[#1, 0.05]}, {Blue,
Thickness[0.01], Arrow[#1, 0.05]}] &)]
which does not produce the desired result (vertices with 2 edges in different directions be black, the rest blue). In fact, the code draws no edges at all, just the vertices. My thinking was to apply the Reverse
function to the original set
and then see if the current rule in the slot was a member of the reversed set, which should be the case for A->B
and B->A
.
However I get the error: "If is not a Graphics primitive or directive."
What am I missing?