bool StateGraph::isValid(const IntPairSet& L, const StlBoolMatrix& LL, const SubDigraph& T, const StlIntMatrix& V) const { for (IntPairSetIt it = L.begin(); it != L.end(); ++it) { int x = it->first; int y = it->second; if (V[x][y] == 0) return false; } // check #2: all leaves are in L for (SubNodeIt v(T); v != lemon::INVALID; ++v) { bool leaf = SubOutArcIt(T, v) == lemon::INVALID; if (leaf && !LL[_x[v]][_y[v]]) { return false; } } return true; }
int StateGraph::enumerate(const IntPairSet& L, bool includeMutationEdge) { BoolNodeMap filterNodesT(_G, false); BoolArcMap filterArcsT(_G, false); SubDigraph T(_G, filterNodesT, filterArcsT); BoolNodeMap filterNodesG(_G, true); BoolArcMap filterArcsG(_G, true); SubDigraph subG(_G, filterNodesG, filterArcsG); ArcList F; init(includeMutationEdge, subG, T, F); Arc a = lemon::INVALID; StlIntMatrix V(_max_x+1, StlIntVector(_max_x+1, 0)); V[1][1] = 1; StlBoolMatrix LL(_max_x+1, StlBoolVector(_max_x+1, false)); for (IntPairSetIt it = L.begin(); it != L.end(); ++it) { int x = it->first; int y = it->second; LL[x][y] = true; } _result.clear(); grow(L, LL, includeMutationEdge, subG, T, F, V, a); return _result.size(); }