Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
535
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 <- graph_from_literal(Origin -- One:Two:Three, One:Two:Three -- A:B:C:D, A:B:C:D -- I:II:III, I:II:III -- W:X:Y:Z, W:X:Y:Z -- Destination)
  3. E(g)$weight <- c(0,0,0,4,3,6,5,5,5,7,5,2,5,3,4,6,4,6,5,3,7,3,5,3,4,5,8,4,3,6,5,5,5,7,5,2,5,3,4,0,0,0,0)
  4. E(g)$capacity <- c(200,250,300,rep(c(120,200,200,150),3),rep(c(250,200,150),4),rep(c(50,190,120,200),3),50,190,120,200)
  5.  
  6. max_flow(g,"Origin","Destination")
  7.  
  8. [1] 200 210 150 0 0 50 150 0 0 100 110 0 0 150 0 0 0 0 0
  9. [20] 0 0 0 150 150 100 60 100 50 0 0 50 0 0 120 90 0 190 0
  10. [39] 60 50 190 120 200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement