Skip to content

Instantly share code, notes, and snippets.

@Puriney
Last active February 14, 2017 03:39
Show Gist options
  • Save Puriney/f9b199e8fcad268bc6681d6a668fa00d to your computer and use it in GitHub Desktop.
Save Puriney/f9b199e8fcad268bc6681d6a668fa00d to your computer and use it in GitHub Desktop.
Minimum example to remove edges connecting nodes of interest
set.seed(1234)
g <- sample_gnp(n=10, 0.15) #make_ring(10)
V(g)$name <- letters[1:10]
plot(g)
rm_e <- combinations(n=3, r=2, v=c('b', 'i', 'c'))
rm_e_do <- apply(rm_e, 1, function(r) are.connected(g, r[1], r[2]))
rm_e <- rm_e[rm_e_do, ] %>% apply(., 1, paste, collapse='|')
par(mfrow=c(1, 2))
plot(g)
plot(g - edge(rm_e))
dev.off()
@Puriney
Copy link
Author

Puriney commented Feb 14, 2017

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment