# How to label a large number of vertices using a list of names

I am using CommunityGraphPlot on a network with 500ish nodes. I am defining the graph using a variable adjmatrix which is the adjacency matrix of the network. Right now the nodes are just named by number. I have a list vertexnames where the index of each entry is that number node. How do I use CommunityGraphPlot so that each vertex is labelled with the corresponding name in vertexnames?

• What do you get from Options[CommunityGraphPlot]? – Jason B. Jan 25 '17 at 2:36
• The relevant Option seems to be VertexLabels although I don't know how to assign them to the list entries. – tharvey Jan 25 '17 at 2:43
• Neither do I, but I'd start with smaller examples to figure out the syntax, or look at the help page to see if it gives examples on VertexLabels – Jason B. Jan 25 '17 at 2:46
• Is this not practically the same question you posted yesterday, but with fewer details? – MarcoB Jan 25 '17 at 4:28
• I intended this one to be about how to label the vertices and the one yesterday to be about the display size. I cannot figure out the syntax for labelling vertices, even after looking through the documentation on Wolframs site. – tharvey Jan 25 '17 at 4:38

Read up on VertexLabels and Thread.

Here's an example—first we create an example graph with no human readable vertex names and a list of names:

g = ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}];
names = VertexList[g];
g = IndexGraph[g];


Then label the nodes:

CommunityGraphPlot[g, VertexLabels -> Thread[VertexList[g] -> names]]