# I am not able to label the vertex of the following graph in mathematica, can some one please help me

Graph[{1, 2, 3, 4, 5, 6}, {1 -> 2, 1 -> 3, 2 -> 5, 2 -> 6, 5 -> 6},
VertexLabeling -> True]

Graph::optx: Unknown option VertexLabeling in Graph[{1,2,3,4,5,6},{1->2,1->3,2->5,2->6,5->6},VertexLabeling->True].

GraphPlot[{1, 2, 3, 4, 5, 6}, {1 -> 2, 1 -> 3, 2 -> 5, 2 -> 6,
5 -> 6}, VertexLabeling -> True]

GraphPlot::argx: GraphPlot called with 2 arguments; 1 argument is expected. >>


This was the message came after trying to draw the graph.

• VertexLabeling works with GraphPlot, but not with Graph. GraphPlot only expects one argument. If you drop the $\{1,2,3,4,5,6\}$ then the GraphPlot command works. – almagest May 24 '16 at 11:44
• But that will give only the dots right, I need a graph with edges as well as isolated vertices also. – Ashwin Koodathil May 24 '16 at 11:48
• GraphPlot[{1 -> 2, 1 -> 3, 2 -> 5, 2 -> 6, 5 -> 6}, VertexLabeling -> True] gives dots and edges. – almagest May 24 '16 at 11:48

Seems in Mathematica 10 you should use the VertexLabels option. So, your code can be written like this:

Graph[{1, 2, 3, 4, 5, 6}, {1 -> 2, 1 -> 3, 2 -> 5, 2 -> 6, 5 -> 6},
VertexLabels -> "Name"]


Which will give the result shown below:

Just to illustrate some ways to motivate play:

{v, e} = {{1, 2, 3, 4, 5, 6}, {1 -> 2, 1 -> 3, 2 -> 5, 2 -> 6,
5 -> 6}};
GraphPlot[e, VertexLabeling -> All]
Graph[v, e, VertexLabels -> Placed["Name", Center],
VertexStyle -> LightBlue, VertexSize -> 0.6]
GraphPlot[e,
VertexRenderingFunction -> (Text[
Framed[Style[#2, Red], Background -> White], #1] &)]