示例#1
0
void TarjanHD::run()
{
  _T.clear();

  NodeNodeMap mapToOrgG(_orgG, lemon::INVALID);
  for (NodeIt v(_orgG); v != lemon::INVALID; ++v)
  {
    mapToOrgG[v] = v;
  }
  
  ArcList arcs;
  for (ArcIt a(_orgG); a != lemon::INVALID; ++a)
  {
    arcs.push_back(a);
  }

  // sort by weight
  arcs.sort(Comparison(_orgW));

  BoolArcMap arcFilter(_orgG, true);
  BoolNodeMap nodeFilter(_orgG, true);
  NodeNodeMap G2T(_orgG, lemon::INVALID);
 
  SubDigraph subG(_orgG, nodeFilter, arcFilter);
  
  _root = hd(_orgG, _orgW, subG, mapToOrgG, G2T, arcs, 0);
  fixTree(_root);
}
示例#2
0
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();
}