Removing N random nodes from a graph in R

I am new to R / igraph. I would like to remove N nodes randomly from the graph. However, I could not find the right way to do this. I created the Erdos-Renyi graph using the igraph package with 400 vertices.

igraph provides removal of vertices, but not randomly. For example: delete.vertices(graph, v).

I referenced this documentation.

I also browsed the web pages and previous stack overflow questions, but could not get the correct answer.

Can someone tell or pass me the documentation on how to remove N (let's say N = 100) random nodes?

+4
source share
1 answer

1 400:

random.deletes <- runif(n=100, min=1, max=400)

:

my.new.graph <- delete.vertices(graph, random.deletes)

, , :

my.new.graph <- delete.vertices(graph, runif(n=100, min=1, max=400))
+4

All Articles