Thursday, December 26, 2019

Graph Styling 4


GS={"DodecahedralGraph","NauruGraph","IcosahedralGraph"};
CV[g_]:=Table[i->ColorData["BrightBands"]
[i/Length[GraphData[g,"Vertices"]]],
{i,GraphData[g,"Vertices"]}];
CE[g_]:=Flatten[Table[Table[i<->j->
ColorData["BrightBands"][i/Length[GraphData[g,"Vertices"]]],
{j,AdjacencyList[GraphData[g],i]}],{i,GraphData[g,"Vertices"]}]];
CGP=Function[{g,n},GraphPlot[GraphData[g,"Graph","All"][[n]],
VertexSize->.2,VertexStyle->CV[g],EdgeStyle->CE[g],
VertexShapeFunction->"ConcavePentagon",
EdgeShapeFunction->"CarvedArrow",ImageSize->600]];
CGP["NauruGraph",6]


No comments:

Post a Comment