Skip to main content
7 of 10
added 88 characters in body
kglr
  • 403.4k
  • 18
  • 501
  • 959

Update: You can also use custom functions for the options EdgeShapeFunction and VertexShapeFunction:

ClearAll[eSf, vSf] eSf[g_, cols_] := Module[{bsf = BSplineFunction[{#[[1]], RegionNearest[Disk[Mean[#[[{1, -1}]]], Norm[#[[1]] - #[[-1]]]], {0, 0}], #[[-1]]}], p1 = Subdivide[0, 1/2, 50], p2 = Subdivide[1/2, 1, 50]}, {Thin, cols[[VertexIndex[g, #2[[1]]]]], Line[bsf /@ p1], cols[[VertexIndex[g, #2[[2]]]]], Line[bsf /@ p2]}] &; vSf[g_, cols_] := Module[{opos = {If[-Pi/2 < ArcTan @@ # < Pi/2, Left, Right], Center}, dir = ArcTan[#] If[-Pi/2 < ArcTan @@ # < Pi/2, 1, -1]}, {cols[[VertexIndex[g, #2]]], Text[Style[Framed[#2, FrameStyle -> None], FontSize -> Scaled[.03]], #, opos, dir ], PointSize[Large], Point @ #}] &; 

Example:

g = ExampleData[{"NetworkGraph", "LesMiserables"}, "FullGraph"]; cols = RandomSample[ColorData[{"Rainbow", {1, VertexCount@g}}] /@ Range[VertexCount[g]]]; SetProperty[g, {ImageSize -> Large, GraphLayout -> "CircularEmbedding", VertexShapeFunction -> vSf[g, cols], EdgeShapeFunction -> eSf[g, cols]}] 

enter image description here

You can add Epilog -> Circle[] in the second argument of SetProperty above to get:

enter image description here

Original answer:

You can use BSplineFunction:

cps1 = {{8, 5}, {0, 0}, {10, 1}}; Graphics[{Thick, Red, Line[BSplineFunction[cps1] /@ Subdivide[0, 1/2, 50]], Blue, Line[BSplineFunction[cps1] /@ Subdivide[1/2, 1, 50]]}] 

enter image description here

kglr
  • 403.4k
  • 18
  • 501
  • 959