Given a grid graph:
and delete the vertices {3, 4, 5, 11, 14, 15, 16, 17, 18, 19, 21, 23, 26, 27, 30}
and preserve the structure. There is the VertexDelete
command but I am unable to get it working while preserving the structure.
SeedRandom[10801];
dimension = 5;
coDimension = 10;
percProbability = 0.7;
deleteMe =
Pick[Table[i, {i, 1, 30}], Table[RandomReal[] > 0.5, {i, 30}]]
G = GridGraph[{dimension, coDimension}, VertexLabels -> "Name",
ImagePadding -> 30]
How can you delete a list of vertices from a GridGraph?
p.s. Related to this percolation puzzle here for which I want to solve this.
g = SetProperty[g, VertexCoordinates -> GraphEmbedding[g]]
before deleting vertices. $\endgroup$