# How to get VertexDelete to work?

I'm using Mathematica 9 and want to delete a single vertex and all associated edges on a graph but can't seem to get the function VertexDelete function to work. My code is below. I declare a graph "newgraph" and GraphPlot works fine but when I call VertexDelete I get the following error:

VertexDelete::graph: A graph object is expected at position 1 in VertexDelete[{0->1,0->3,0->6,0->11,0->12,0->14,0->30,0->56,0->75,0->76,0->78,0->86,0->94,0->112,0->120,0->222,0->232,0->248,0->504,0->960,1->7,1->12,1->14,1->15,1->31,1->57,1->62,1->75,1->76,1->78,1->79,1->86,1->94,1->95,1->112,1->116,1->120,1->121,1->124},79]. >>

My code is:

newgraph = {0 -> 1, 0 -> 3, 0 -> 6, 0 -> 11, 0 -> 12, 0 -> 14,
0 -> 30, 0 -> 56, 0 -> 75, 0 -> 76, 0 -> 78, 0 -> 86, 0 -> 94,
0 -> 112, 0 -> 120, 0 -> 222, 0 -> 232, 0 -> 248, 0 -> 504,
0 -> 960, 1 -> 7, 1 -> 12, 1 -> 14, 1 -> 15, 1 -> 31, 1 -> 57,
1 -> 62, 1 -> 75, 1 -> 76, 1 -> 78, 1 -> 79, 1 -> 86, 1 -> 94,
1 -> 95, 1 -> 112, 1 -> 116, 1 -> 120, 1 -> 121, 1 -> 124}

GraphPlot[newgraph, VertexLabeling -> True]

VertexDelete[newgraph, 79]


As far as I am aware, I am indeed passing a graph as an argument! Someone please help me!

Many thanks.

-
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign – Vitaliy Kaurov Feb 21 '13 at 15:03

VertexDelete works on Graph objects, not on List. So build graph and delete vertex from there:

g = Graph[newgraph];
VertexDelete[g, 79]


I recommend putting vertex labels on to see it really works - like here:

cg = CompleteGraph[5, VertexLabels -> "Name"]
VertexDelete[cg, 2]
`

-