Last active
February 14, 2017 03:39
-
-
Save Puriney/f9b199e8fcad268bc6681d6a668fa00d to your computer and use it in GitHub Desktop.
Minimum example to remove edges connecting nodes of interest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Author
Puriney
commented
Feb 14, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment