Created
June 24, 2021 09:38
-
-
Save jinhangjiang/c69e88888ac80b4bbbfa6164a696a914 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
## remove specific nodes/vertices | |
h1 <- g - vertices(c("Adam","Judy")) | |
## generate subgraph by manual input | |
h2 <- graph_from_literal("Adam"-"Judy", "Adam"-"Bobby", "Adam"-"Sam", "Judy"-"Bobby","Judy"-"Frank") | |
## join graphs | |
h3 <- union(h1,h2) | |
# or, h3 <- h1 + h2 | |
# compare the graphs | |
par(mfrow=c(2, 2)) | |
set.seed(4) | |
plot(g) | |
plot(h1) | |
plot(h2) | |
plot(h3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment