The previous answers are wonderful. But at the risk of being repetitive, here is another answer. I believe what you really desire is to replace multi-directed edges with bi-directed edges as well as identifying group elements via tooltips and distinguishing unity. For example:
CG[PermutationGroup[{Cycles[{{1, 5, 4}}], Cycles[{{3, 4}}]}], 3]
CG[PermutationGroup[{Cycles[{{1, 5, 4}}], Cycles[{{3, 4}}]}], 2]
In this fashion distractions are minimized. Here is the code:
mc[n : {___Integer}, func_List, list_List] :=
Map[Fold[MapAt[#2[[1]], #1, List /@ #2[[2]]] &, #,
Transpose[{func, n}]] &, list];
mc[n : {___Integer}, func_, list_List] :=
Map[MapAt[func, #, List /@ n] &, list];
mc[n_Integer, func_, list_List] := Map[MapAt[func, #, n] &, list];
formatCycles[c_Cycles] :=
Row[Riffle[Row[Flatten@{"(", Riffle[#, " "], ")"}] & /@ c[[1]],
" "]];
formatCycles[c_] :=
Row[Flatten[({"(", If[Length[#] > 1, Riffle[#, " "], #], ") "}) & /@
c[[1]]]];
formatCycles[c_] := "" /; Sort[c] == c;
formatCycles[{}] := Style["(identity)", Gray];
formatCycles[Cycles[{}]] := Style["(identity)", Gray];
formatCycles[Cycles[{{}}]] := Style["(identity)", Gray];
$imageSize = 300;
CG[group_, dim_] :=
Module[{v, e, edgeStyle, edgeColor, tools, eTool, vTool, ef, vf,
len, $CG, tooltips}, $CG = CayleyGraph[group];
tooltips = AbsoluteOptions[$CG, Properties][[1, 2]];
v = VertexList[$CG];
len = Length[v];
e = Rule @@@ EdgeList[$CG];
edgeStyle = PropertyValue[$CG, {EdgeStyle}][[1, 2]];
tools =
SplitBy[Sort[AbsoluteOptions[$CG, Properties][[1, 2]]],
Length[First[#]] &];
(edgeColor[List @@ #1] = Lighter@#2[[1]]) & @@@
mc[1, Rule @@ # &, edgeStyle];
(vTool[First[#]] = formatCycles@Last[#][[1, 2]]) & /@ tools[[1]];
(eTool[List @@ First[#]] = formatCycles@Last[#][[1, 2]]) & /@
tools[[2]];
If[len > 30,
If[dim == 2,
ef = ({edgeColor[#2], Arrowheads -> Medium,
Tooltip[Arrow[#1, 0.01], eTool[#2]]} &);
vf = ({Lighting -> "Neutral", EdgeForm[Black],
RGBColor[0.696078431372549, 0.7588235294117647,
0.845098039215686],
Tooltip[If[
len < 60, {Disk[#, .1], Black, Text[#2, #1]}, {Black,
Point[#]}], vTool[#2]]} &);
GraphPlot[e, EdgeRenderingFunction -> ef,
VertexRenderingFunction -> vf, ImageSize -> $imageSize,
ImageMargins -> 0, PlotRangePadding -> 0, ImagePadding -> None,
MultiedgeStyle -> 0.001],
ef = ({edgeColor[#2], Arrowheads -> Small,
Tooltip[Arrow[#1], eTool[#2]]} &);
vf = ({Lighting -> "Neutral", Specularity[Brown, 3], Brown,
Tooltip[If[
len < 60, {Sphere[#, 0.05], Black,
Text[#2, #1]}, {Sphere[#, .1]}], vTool[#2]]} &);
GraphPlot3D[e, EdgeRenderingFunction -> ef, ViewAngle -> All,
PlotRangePadding -> 0, ImageSize -> $imageSize, Boxed -> False,
PlotRangePadding -> 0 ImageMargins -> 0, ImagePadding -> 0,
MultiedgeStyle -> 0.001]],
If[dim == 2,
ef = ({edgeColor[#2], Arrowheads -> Medium,
Tooltip[Arrow[#1, 0.12], eTool[#2]]} &);
vf = ({EdgeForm[{Black}],
If[#2 == 1, Blue, RGBColor[0.639216, 0.705882, 0.8]],
Tooltip[{Disk[#, 0.05]}, vTool[#2]]} &);
GraphPlot[e, EdgeRenderingFunction -> ef,
VertexRenderingFunction -> vf, ImageSize -> $imageSize,
ImageMargins -> 0, PlotRangePadding -> 0, ImagePadding -> 10,
MultiedgeStyle -> 0.001],
ef = ({edgeColor[#2], Arrowheads -> Medium,
Tooltip[Arrow[#1], eTool[#2]]} &);
vf = ({Lighting -> "Neutral", Specularity[Brown, 3],
If[#2 == 1, Hue[0.6], Gray],
Tooltip[If[len < 60, {Sphere[#, 0.1]}, {Point[#]}],
vTool[#2]]} &);
GraphPlot3D[e, EdgeRenderingFunction -> ef,
VertexRenderingFunction -> vf, ImageSize -> $imageSize,
Boxed -> True, PlotRangePadding -> 0, ImageMargins -> 0,
ImagePadding -> 0, MultiedgeStyle -> 0.001]]]]
\[DirectedEdge]
, and then replacing (usingEdgeDelete
andEdgeAdd
) those with a single\[UndirectedEdge]
(somehow of the same color). But I have no idea how to do that. Alternately, in may be that a this requires a replacement forCayleyGraph
that builds a graph from scratch (e.g., from some form of group specification or the output ofGroupGenerators
andGroupElements
). $\endgroup$Graph::supp: Mixed graphs and multigraphs are not supported.
No idea what that means. I can't check the result right now (for running the front end over the internet I just don't have the necessary bandwidth, so I can only use the kernel right now). Anyway, here's my code:Module[{vl=VertexList[#], el=EdgeList[#]}, Graph[vl, el /. {x_ \[DirectedEdge] y_ /; el ~MemberQ~ (y \[DirectedEdge] x) :> If[Order[x, y]==1, x \[UndirectedEdge] y, Unevaluated@Sequence[]]}]]&
$\endgroup$