max_flow  R Documentation 
In a graph where each edge has a given flow capacity the maximal flow between two vertices is calculated.
max_flow(graph, source, target, capacity = NULL)
graph 
The input graph. 
source 
The id of the source vertex. 
target 
The id of the target vertex (sometimes also called sink). 
capacity 
Vector giving the capacity of the edges. If this is

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 nonnegative 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.
A named list with components:
value 
A numeric scalar, the value of the maximum flow. 
flow 
A numeric vector, the flow itself, one entry for each edge. For undirected graphs this entry is bit trickier, since for these the flow direction is not predetermined by the edge direction. For these graphs the elements of the this vector can be negative, this means that the flow goes from the bigger vertex id to the smaller one. Positive values mean that the flow goes from the smaller vertex id to the bigger one. 
cut 
A numeric vector of edge ids, the minimum cut corresponding to the maximum flow. 
partition1 
A numeric vector of vertex ids, the vertices in the first partition of the minimum cut corresponding to the maximum flow. 
partition2 
A numeric vector of vertex ids, the vertices in the second partition of the minimum cut corresponding to the maximum flow. 
stats 
A list with some statistics from the pushrelabel
algorithm. Five integer values currently: 
A. V. Goldberg and R. E. Tarjan: A New Approach to the Maximum Flow Problem Journal of the ACM 35:921940, 1988.
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"])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.