title: Adding edges to a graph in Boost.Graph
body: <p>I am trying to use the Boost.Graph Library to run Goldberg's Max-Flow Algorithm. Boost.Graph calls it <a href="http://www.boost.org/doc/libs/1_60_0/libs/graph/doc/push_relabel_max_flow.html" rel="nofollow">push_relabel_max_flow</a>. </p>
  
  <p>However, I have a very hard time understanding the library and its type-system. The documentation, which I linked above, gives an example code. But in that example, the graph is read from a file. I want to generate the graph at runtime. This is the code I have so far (mostly copied from the example):</p>
  
  <pre><code>typedef boost::adjacency_list_traits&lt;boost::vecS, boost::vecS, boost::directedS&gt; Traits;
  typedef boost::adjacency_list&lt;boost::vecS, boost::vecS, boost::directedS, 
          boost::property&lt;boost::vertex_name_t, std::string&gt;, 
          boost::property&lt;boost::edge_capacity_t, long, 
              boost::property&lt;boost::edge_residual_capacity_t, long, 
                  boost::property&lt;boost::edge_reverse_t, Traits::edge_descriptor&gt;&gt;&gt;&gt; DirectedGraph;
  
  DirectedGraph g;
  Traits::vertex_descriptor s, t;
  
  
  s = boost::add_vertex(g);
  t = boost::add_vertex(g);
  boost::add_vertex(g);
  boost::add_vertex(g);
  </code></pre>
  
  <p>After I added 4 vertices to the graph I should "connect" them, i.e., making edges with a capacity, residual capacity and the reverse value. The function for this task is <code>boost::add_edge()</code> but I have no clue how I can pass my arguments. The example code does not show it, because as I said, the data is read from a file and then directly parsed to a graph. Maybe someone with experience in the Boost.Graph library can show me how.</p>