Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. library(igraph)
  2. g <- sample_smallworld(1, 100, 5, 0.1)
  3.  
  4. > get.shortest.paths(g,4,19)
  5. $vpath
  6. $vpath[[1]]
  7. + 4/100 vertices, from f2866bd:
  8. [1] 4 100 98 19
  9.  
  10. d1 <- unlist(neighborhood(g, 1, 4, mode="out"))
  11. [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
  12.  
  13. d1 <- unlist(neighborhood(g, 1, 4, mode="out"))
  14. d2 <- unlist(neighborhood(g, 2, 4, mode="out"))
  15. d3 <- setdiff(d2,d1)
  16. [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
  17.  
  18. > unlist(neighborhood(g, 1, 19, mode="out"))
  19. [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