MaximumMatching { private void blossom(int v, int w, int base) { base = uf.find(base); int[] supports1 = blossomSupports(v, w, base); int[] supports2 = blossomSupports(w, v, base); for (int i = 0; i < supports1.length; i++) uf.union(supports1[i], supports1[0]); for (int i = 0; i < supports2.length; i++) uf.union(supports2[i], supports2[0]); even[uf.find(base)] = even[base]; } private  MaximumMatching(Graph graph, Matching matching, int nMatched, IntSet subset);   }
@Test public void blossom() throws Exception { Graph g = Graph.fromSmiles("CCCCCC1CCCC1CC"); Matching m = Matching.empty(g); m.match(1, 2); m.match(3, 4); m.match(5, 6); m.match(7, 8); m.match(9, 10); MaximumMatching.maximise(g, m, 10); assertThat(m.matches(), IsIterableWithSize.<Tuple>iterableWithSize(6)); assertThat(m.matches(), hasItems(Tuple.of(0, 1), Tuple.of(2, 3), Tuple.of(4, 5), Tuple.of(6, 7), Tuple.of(8, 9), Tuple.of(10, 11))); }