I have a R Graph object which has 20 isolate nodes.
I wish to remove all of them. Can you please guide me how I should write my function and arguments.
Thanks in anticipation
Regards
DHARMA
INDIA
I have a R Graph object which has 20 isolate nodes.
I wish to remove all of them. Can you please guide me how I should write my function and arguments.
Thanks in anticipation
Regards
DHARMA
INDIA
A simple solution:
remove_isolates <- function(g) {
g.degree <- degree(g)
g.isolates <- V(g)[which(g.degree < 1)]
return(delete_vertices(g, g.isolates))
}
Thank you so much Dan.
It worked.
Cheers & Warm Regards
SHRINIVAS