Arbitrary Expression inside Graphs
Arbitrary Expression inside Graphs
Any arbitrary expression can be used as graph elements, shapes, and labels.
spring[{p1 : {x1_, y1_}, p2 : {x2_, y2_}}, rest___] := Module[{normal = Reverse[(p1 - p2)]},
BezierCurve[Table[{(1 - t)x1 + t x2, (1 - t)y1 + t y2 } + {1, -1} normal .1 Mod[24 t, 3, -1], {t, 0, 1, 1 / 24}]]
];vlabels = {3 -> Placed[[image], Above], 0 -> Placed[Panel[Plot[Sin[x], {x, 0, 2Pi}, Frame -> True, FrameTicks -> None, ImageSize -> 30]], After]};elabels = {21 -> Placed[Rotate[Style["Wolfram", 12, Blue, FontFamily -> "Verdana"], -21 Degree], {.5, {.45, .35}}], 52 -> CompleteGraph[3, ImageSize -> 30, VertexSize -> Large, PlotTheme -> "BasicBlue"]};styles = {VertexLabels -> vlabels, VertexShape -> {1 -> [image]}, VertexSize -> Medium, EdgeLabels -> elabels, EdgeShapeFunction -> {63 -> spring}, GraphLayout -> "SpringEmbedding", PlotTheme -> "BasicBlue"};Graph[Table[j -> FromDigits[Drop[IntegerDigits[j, 2], -1], 2], {j, 1, 6}], styles]