Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(igraph)
- g <- sample_smallworld(1, 100, 5, 0.1)
- > get.shortest.paths(g,4,19)
- $vpath
- $vpath[[1]]
- + 4/100 vertices, from f2866bd:
- [1] 4 100 98 19
- d1 <- unlist(neighborhood(g, 1, 4, mode="out"))
- [1] 20 28 96 97 36 59 44 60 98 10 31 11 24 12 34 47 13 19 14 58 62 88 94 95
- d1 <- unlist(neighborhood(g, 1, 4, mode="out"))
- d2 <- unlist(neighborhood(g, 2, 4, mode="out"))
- d3 <- setdiff(d2,d1)
- [1] 20 28 96 97 36 59 44 60 98 10 31 11 24 12 34 47 13 19 14 58 62 88 94 95
- > unlist(neighborhood(g, 1, 19, mode="out"))
- [1] 19 8 14 15 16 17 18 20 21 22 24 66 92 98
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement