I'm using AdjacencyGraph
to plot a graph corresponding to an undirected, unweighted 5-node network. Each node is assigned a different color. Here's what I have so far:
A = {{0, 1, 1, 0, 0}, {1, 0, 1, 0, 0}, {1, 1, 0, 1, 1}, {0, 0, 1, 0,
1}, {0, 0, 1, 1, 0}};
Labels = {1, 2, 3, 4, 5};
VertexNames = Table[i -> Labels[[i]], {i, 5}];
col = Range[5] /. {1 -> Red, 2 -> Green, 3 -> Blue, 4 -> Purple,
5 -> Orange};
G = AdjacencyGraph[A, VertexLabels -> VertexNames,
VertexStyle -> Thread[Range[5] -> col], VertexSize -> Medium,
VertexLabelStyle -> Large]
This does exactly as I would expect. However, now I want to assign colors based upon a partition of the vertices. For example, suppose I have
{{1,3,4},{2,5}}
and I would like for the nodes in each of the two lists to be colored identically.
I'm not doing this for purposes of plotting a community partition as one would be using the CommunityGraphPlot
command.
I do have IGraph/M installed if there's any easy way to accomplish this using it.