igraph - Removal of N Random nodes from the graph in R -
i new r/igraph. remove n nodes randomly graph. however, not find right way that. have generated erdos-renyi graph of igraph package 400 vertices.
igraph provides deletion of vertices, not in random way. example: delete.vertices(graph, v)
.
i referred this documentation.
i searched web , previous questions on stack overflow, not right answer.
can please tell or refer me documentation on how remove n (lets n = 100) random nodes?
basically need generate vector of random numbers ranging 1 400:
random.deletes <- runif(n=100, min=1, max=400)
and apply it:
my.new.graph <- delete.vertices(graph, random.deletes)
of course, both can done @ once you'd lose track of deleted nodes:
my.new.graph <- delete.vertices(graph, runif(n=100, min=1, max=400))
Comments
Post a Comment