MCPcopy Create free account
hub / github.com/BirolLab/abyss / pruneTips_if

Function pruneTips_if

Graph/ContigGraphAlgorithms.h:261–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259 */
260template<typename Graph, typename OutputIt, typename Pred>
261OutputIt
262pruneTips_if(Graph& g, OutputIt result, Pred p)
263{
264 typedef typename graph_traits<Graph>::adjacency_iterator Vit;
265 typedef typename graph_traits<Graph>::vertex_iterator Uit;
266 typedef typename graph_traits<Graph>::vertex_descriptor V;
267
268 /** Identify the tips. */
269 std::vector<V> tips;
270 std::pair<Uit, Uit> urange = vertices(g);
271 for (Uit uit = urange.first; uit != urange.second; ++uit) {
272 V u = *uit;
273 if (out_degree(u, g) < 2)
274 continue;
275 std::pair<Vit, Vit> vrange = adjacent_vertices(u, g);
276 for (Vit vit = vrange.first; vit != vrange.second; ++vit) {
277 V v = *vit;
278 // assert(v != u);
279 if (out_degree(v, g) == 0 && p(v))
280 tips.push_back(v);
281 }
282 }
283
284 /** Remove the tips. */
285 remove_vertex_if(g, tips.begin(), tips.end(), True<V>());
286 std::transform(
287 tips.begin(), tips.end(), result, [](const ContigNode& c) { return c.contigIndex(); });
288 return result;
289}
290
291/** Return true if the vertex is a normal 1-in 0-out tip. */
292template<typename Graph>

Callers 2

pruneTipsFunction · 0.85
mainFunction · 0.85

Calls 8

remove_vertex_ifFunction · 0.85
contigIndexMethod · 0.80
verticesFunction · 0.70
out_degreeFunction · 0.70
adjacent_verticesFunction · 0.70
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected