Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(igraph)
- 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)
- 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)
- 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)
- max_flow(g,"Origin","Destination")
- [1] 200 210 150 0 0 50 150 0 0 100 110 0 0 150 0 0 0 0 0
- [20] 0 0 0 150 150 100 60 100 50 0 0 50 0 0 120 90 0 190 0
- [39] 60 50 190 120 200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement