max.flow                package:RBGL                R Documentation

_C_o_m_p_u_t_e _m_a_x _f_l_o_w _f_o_r _a _d_i_r_e_c_t_e_d _g_r_a_p_h

_D_e_s_c_r_i_p_t_i_o_n:

     Compute max flow for a directed graph

_U_s_a_g_e:

     edmunds.karp.max.flow(g, source, sink)
     push.relabel.max.flow(g, source, sink)

_A_r_g_u_m_e_n_t_s:

       g: an instance of the 'graph' class with 'edgemode' "directed"

  source: node name (character) or node number (int) for the source of
          the flow 

    sink: node name (character) or node number (int) for the sink of
          the flow 

_D_e_t_a_i_l_s:

     Given a directed graph G=(V, E) of a single connected component
     with a vertex 'source' and a vertex 'sink'.  Each arc has a
     positive real valued capacity, currently it's equivalent to the
     weight of the arc.  The flow of the network is the net flow
     entering the vertex 'sink'. The maximum flow problem is to
     determine the maximum possible value for the flow to the 'sink'
     and the corresponding flow values for each arc.

_V_a_l_u_e:

edmunds.karp.max.flow: the max flow from 'source' to 'sink' using
          Edmuns-Karp algorithm

push.relabel.max.flow: the max flow from 'source' to 'sink' using
          Push-Relabel algorithm

   edges: the nodes of the arcs with non-zero capacities

   flows: the flow values of the arcs with non-zero capacities

_A_u_t_h_o_r(_s):

     Li Long <li.long@isb-sib.ch>

_R_e_f_e_r_e_n_c_e_s:

     Boost Graph Library by Siek et al.

_S_e_e _A_l_s_o:

_E_x_a_m_p_l_e_s:

     g <- fromGXL(file(system.file("XML/dijkex.gxl",package="RBGL")))

     ans1 <- edmunds.karp.max.flow(g, "B", "D")
     ans2 <- edmunds.karp.max.flow(g, 3, 2)     # 3 and 2 equivalent to "C" and "B"

     ans3 <- push.relabel.max.flow(g, 2, 4)     # 2 and 4 equivalent to "B" and "D"
     ans4 <- push.relabel.max.flow(g, "C", "B")

