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

Function addComplementaryEdges

Graph/ContigGraphAlgorithms.h:351–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349/** Add missing complementary edges. */
350template<typename DG>
351size_t
352addComplementaryEdges(ContigGraph<DG>& g)
353{
354 typedef ContigGraph<DG> Graph;
355 typedef graph_traits<Graph> GTraits;
356 typedef typename GTraits::edge_descriptor E;
357 typedef typename GTraits::edge_iterator Eit;
358 typedef typename GTraits::vertex_descriptor V;
359
360 std::pair<Eit, Eit> erange = edges(g);
361 size_t numAdded = 0;
362 for (Eit eit = erange.first; eit != erange.second; ++eit) {
363 E e = *eit;
364 V u = source(e, g), v = target(e, g);
365 V uc = get(vertex_complement, g, u);
366 V vc = get(vertex_complement, g, v);
367 E f;
368 bool found;
369 boost::tie(f, found) = edge(vc, uc, g);
370 if (!found) {
371 add_edge(vc, uc, g[e], static_cast<DG&>(g));
372 numAdded++;
373 } else if (!(g[e] == g[f])) {
374 // The edge properties do not agree. Select the better.
375 g[e] = g[f] = BetterDistanceEst()(g[e], g[f]);
376 }
377 }
378 return numAdded;
379}
380
381#endif

Callers 4

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
readGraphsFunction · 0.85

Calls 5

BetterDistanceEstClass · 0.85
edgesFunction · 0.70
getFunction · 0.70
edgeFunction · 0.70
add_edgeFunction · 0.70

Tested by

no test coverage detected