@Test public void furan_2() throws Exception { Graph g = Graph.fromSmiles("c1ccoc1"); Matching m = Matching.empty(g); ArbitraryMatching.initial(g, m, allOf(0, 1, 2, 4)); assertThat(m.matches(), IsIterableWithSize.<Tuple>iterableWithSize(1)); assertThat(m.matches(), hasItem(Tuple.of(0, 1))); }
static int initial(final Graph g, Matching m, final BitSet s) { int nMatched = 0; for (int v = s.nextSetBit(0); v >= 0; v = s.nextSetBit(v + 1)) { if (m.matched(v)) continue; int d = g.degree(v); for (int j = 0; j < d; ++j) { Edge e = g.edgeAt(v, j); int w = e.other(v); if ((e.bond() != Bond.SINGLE) && m.unmatched(w) && s.get(w)) { m.match(v, w); nMatched += 2; break; } } } return nMatched; }
ArbitraryMatching { static int initial(final Graph g, Matching m, final BitSet s) { int nMatched = 0; for (int v = s.nextSetBit(0); v >= 0; v = s.nextSetBit(v + 1)) { if (m.matched(v)) continue; int d = g.degree(v); for (int j = 0; j < d; ++j) { Edge e = g.edgeAt(v, j); int w = e.other(v); if ((e.bond() != Bond.SINGLE) && m.unmatched(w) && s.get(w)) { m.match(v, w); nMatched += 2; break; } } } return nMatched; } }
ArbitraryMatching { static int initial(final Graph g, Matching m, final BitSet s) { int nMatched = 0; for (int v = s.nextSetBit(0); v >= 0; v = s.nextSetBit(v + 1)) { if (m.matched(v)) continue; int d = g.degree(v); for (int j = 0; j < d; ++j) { Edge e = g.edgeAt(v, j); int w = e.other(v); if ((e.bond() != Bond.SINGLE) && m.unmatched(w) && s.get(w)) { m.match(v, w); nMatched += 2; break; } } } return nMatched; }  }
ArbitraryMatching { static int initial(final Graph g, Matching m, final BitSet s) { int nMatched = 0; for (int v = s.nextSetBit(0); v >= 0; v = s.nextSetBit(v + 1)) { if (m.matched(v)) continue; int d = g.degree(v); for (int j = 0; j < d; ++j) { Edge e = g.edgeAt(v, j); int w = e.other(v); if ((e.bond() != Bond.SINGLE) && m.unmatched(w) && s.get(w)) { m.match(v, w); nMatched += 2; break; } } } return nMatched; }   }
ArbitraryMatching { static int initial(final Graph g, Matching m, final BitSet s) { int nMatched = 0; for (int v = s.nextSetBit(0); v >= 0; v = s.nextSetBit(v + 1)) { if (m.matched(v)) continue; int d = g.degree(v); for (int j = 0; j < d; ++j) { Edge e = g.edgeAt(v, j); int w = e.other(v); if ((e.bond() != Bond.SINGLE) && m.unmatched(w) && s.get(w)) { m.match(v, w); nMatched += 2; break; } } } return nMatched; }    }