void transitivePredecessorComponents(const ComponentGraph& compgraph, Component from, Set& preds) { // we need a hash map, as component graph is no graph with vecS-storage // typedef boost::unordered_map<Component, boost::default_color_type> CompColorHashMap; typedef boost::associative_property_map<CompColorHashMap> CompColorMap; CompColorHashMap ccWhiteHashMap; // fill white hash map ComponentIterator cit, cit_end; for(boost::tie(cit, cit_end) = compgraph.getComponents(); cit != cit_end; ++cit) { //boost::put(ccWhiteHashMap, *cit, boost::white_color); ccWhiteHashMap[*cit] = boost::white_color; } CompColorHashMap ccHashMap(ccWhiteHashMap); // // do DFS // DFSVisitor dfs_vis(compgraph, preds); //LOG("doing dfs visit for root " << *itr); boost::depth_first_visit( compgraph.getInternalGraph(), from, dfs_vis, CompColorMap(ccHashMap)); DBGLOG(DBG,"predecessors of " << from << " are " << printrange(preds)); }
void translateIdxBuildCommandsToBuildCommands( const IdxCommandVector& icommands, const ComponentGraph& cg, CommandVector& commands) { // get components in order of iteration into vector std::vector<Component> indexableComps; { ComponentGraph::ComponentIterator cit, cit_end; for(boost::tie(cit, cit_end) = cg.getComponents(); cit != cit_end; ++cit) { indexableComps.push_back(*cit); } } BOOST_FOREACH(const IdxBuildCommand& ibc, icommands) { BuildCommand bc; BOOST_FOREACH(unsigned idx, ibc.collapse) { assert(idx < indexableComps.size() && "got bad component index"); bc.collapse.push_back(indexableComps[idx]); } BOOST_FOREACH(unsigned idx, ibc.share) { assert(idx < indexableComps.size() && "got bad component index"); bc.share.push_back(indexableComps[idx]); } commands.push_back(bc); }
EvalGraphBuilder::EvalGraphBuilder( ProgramCtx& ctx, ComponentGraph& cg, EvalGraphT& eg, ASPSolverManager::SoftwareConfigurationPtr externalEvalConfig): ctx(ctx), clonedcgptr(cg.clone()), cg(*clonedcgptr), eg(eg), externalEvalConfig(externalEvalConfig), mapping(), unusedEdgeFilter(&cg, &mapping), unusedVertexFilter(&mapping), cgrest(cg.getInternalGraph(), unusedEdgeFilter, unusedVertexFilter) { }