Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It can be hard to know how best to ask or search for answers to this question without knowing its name, but I believe this is an example of Maximal Matching for a bipartite graph. You an find examples on Wikipedia and Google such as:</p> <ul> <li><a href="http://en.wikipedia.org/wiki/Matching_(graph_theory)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Matching_(graph_theory)</a></li> <li><a href="http://www.geeksforgeeks.org/maximum-bipartite-matching/" rel="nofollow noreferrer">http://www.geeksforgeeks.org/maximum-bipartite-matching/</a></li> <li><a href="http://www.wikihow.com/Use-a-Bipartite-Graph-to-Find-the-Maximal-Matching" rel="nofollow noreferrer">http://www.wikihow.com/Use-a-Bipartite-Graph-to-Find-the-Maximal-Matching</a></li> </ul> <p>My understanding of the suggested solution is as follows:</p> <ol> <li>For each A, link it to the first valid B.</li> <li>If B is already linked to another A, recursively check if the other A can be linked to a different B, excluding the B that it was linked to through the rest of the recursive search.</li> <li>If it can, then re-assign other A to other B, otherwise pick the next B for this A and repeat from step 2 (recursively).</li> </ol> <p>Without knowing this solution, I implemented my own possibly imperfect solution a year or two ago, described here:</p> <p><a href="https://stackoverflow.com/questions/5279693/how-to-prune-duplicate-associations-to-yield-a-unique-most-complete-set">How to prune duplicate associations to yield a unique most-complete set</a></p> <p>One thing I noticed in the process that might help you: if you encounter any A or B that can only link to 1 node on the other side, you may want to automatically pick that path and eliminate all other possibilities for the nodes on both ends (repeat until no more are eliminated). If you know that every node should be linked, this might help optimize your search time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload