# Drawing a GraphPlot by preserving the structure of the graph

For eg. GraphPlot[{1 -> 2, 2 -> 1, 3 -> 1, 3 -> 2, 4 -> 1, 4 -> 2, 4 -> 4}, VertexLabeling -> True] 

Then If I remove the edge (say 1->4) and redraw the graphplot then I have

One can see the structure is not preserved. I want that looks like the same as the first one but without the edge 1->4. i.e., with vertices same at the coordinates as the previous one

My second question: I noticed that if I have a huge graph drawn with the option of Graph not GraphPlot I am not able to resize the vertices. How can I resize them?

## 2 Answers

If you have a GraphPlot, then it is simply a Graphics object, and you can't do any of the interactive things you can do with a Graph. Look here for info on the differences between the two functions.

If you want the vertices for the second GraphPlot to have the same coordinates as the first, then you need to specify the VertexCoordinateRules. To do this, you need a list of coordinates, which you can get from a Graph, but not from a GraphPlot. So first you have to create a graph from the edge rules, extract the coordinates via the GraphEmbedding function, and feed those back into either Graph or GraphPlot.

edgelist = {1 -> 2, 2 -> 1, 3 -> 1, 3 -> 2, 4 -> 1, 4 -> 2, 4 -> 4};
With[{g = Graph[edgelist]},
{
GraphPlot[
DeleteCases[edgelist, 4 -> 1],
VertexLabeling -> True,
VertexCoordinateRules ->
Thread[VertexList[g] -> GraphEmbedding[g]]],
Graph[
DeleteCases[edgelist, 4 -> 1],
VertexLabels -> "Name",
VertexCoordinates -> Thread[VertexList[g] -> GraphEmbedding[g]]]
}
]


Only in the Graph can you resize the vertices.

Jason probably has answer you need but I choose to take a blindingly simple interpretation of the question, and offer:

GraphPlot[
{1 -> 2, 2 -> 1, 3 -> 1, 3 -> 2, 4 -> 1, 4 -> 2, 4 -> 4}
, VertexLabeling -> True
] /. {4, 1} -> Sequence[]


For the second question you should be able to use either VertexRenderingFunction or VertexSize, for GraphPlot and Graph respectively. Give a specific example of what you need and I'll try to provide a solution.