title: bipartite graph matching to match two sets
body: <p>I'm a newbie to <code>igraph</code> package in R. I have two sets <code>A</code> and <code>B</code>, each with <code>N</code> vertices <code>(A1, A2, ..., AN)</code> and <code>(B1, B2, ..., BN)</code>. There is an edge between every element of <code>A</code> to every element of <code>B</code>, and I have a function <code>fWgt(Ai, Bj)</code> that returns the weights of the edge between <code>Ai</code> and <code>Bj</code>. </p>
  
  <p>I have been trying to use the <code>igraph</code> package in R to do a weighted maximum bipartite matching, but I haven't been able to formulate the problem as per the <code>igraph</code> package. For instance, in the example given for <code>maximum.bipartite.matching</code> function in the <code>igraph</code> package:</p>
  
  <pre><code>Usage: 
  
  maximum.bipartite.matching(graph, types = NULL, weights = NULL,
     eps = .Machine$double.eps) 
  
  Example: 
  
  g2 &lt;- graph.formula( a-b-c-d-e-f-g )
  V(g2)$type &lt;- rep(c(FALSE,TRUE), length=vcount(g2))
  str(g2, v=TRUE)
  maximum.bipartite.matching(g2)
  </code></pre>
  
  <p>I couldn't figure out how to reformulate my problem (sets <code>A</code>, <code>B</code>, edges by <code>fWgt</code> function) using <code>graph.formula</code>? The <code>str</code> function in the example appears to set the edges, but what would be the equivalent of the <code>str</code> function for my case?</p>
  
  <p><strong>* EDIT *</strong></p>
  
  <p>Thanks for both your replies. I can only select one on SO. </p>