Isolated nodes have no connections or edges and therefore have degree 0. We can use this to select vertices that have 0 degree and delete them using delete.vertices as follows:
> g.new <- delete.vertices(g.new, V(g.new)[ degree(g.new)==0 ])
We can also use delete.vertices to delete a specific vertex. This function creates a new graph. If the vertex does not exist in the graph, you will see an error message Invalid vertex names. Plot the new graph to check whether the isolated vertex has been removed:
> g.new <- delete.vertices(g.new,12)
Deletion reassigns the vertex IDs even in some cases when edges are deleted. Hence, if you are using IDs instead of vertex names, exercise caution as the IDs may change.