max_flow(graph, source, target, capacity = NULL)
NULL
(the default) then the capacity
edge attribute is used.nopush
is the
number of push operations, norelabel
the number of
relabelings, nogap
is the number of times the gap heuristics
was used, nogapnodes
is the total number of gap nodes omitted
because of the gap heuristics and nobfs
is the number of
times a global breadth-first-search update was performed to assign
better height (=distance) values to the vertices.max_flow
calculates the maximum flow between two vertices in a
weighted (ie. valued) graph. A flow from source
to target
is
an assignment of non-negative real numbers to the edges of the graph,
satisfying two properties: (1) for each edge the flow (ie. the assigned
number) is not more than the capacity of the edge (the capacity
parameter or edge attribute), (2) for every vertex, except the source and
the target the incoming flow is the same as the outgoing flow. The value of
the flow is the incoming flow of the target
vertex. The maximum flow
is the flow of maximum value.min_cut
for minimum cut calculations,
distances
, edge_connectivity
,
vertex_connectivity
E <- rbind( c(1,3,3), c(3,4,1), c(4,2,2), c(1,5,1), c(5,6,2), c(6,2,10))
colnames(E) <- c("from", "to", "capacity")
g1 <- graph_from_data_frame(as.data.frame(E))
max_flow(g1, source=V(g1)["1"], target=V(g1)["2"])
Run the code above in your browser using DataLab