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

Function copy_out_edges

Graph/ContigGraphAlgorithms.h:56–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54/** Add the outgoing edges of vertex u to vertex uout. */
55template<typename Graph>
56void
57copy_out_edges(
58 Graph& g,
59 typename Graph::vertex_descriptor u,
60 typename Graph::vertex_descriptor uout)
61{
62 typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
63 typedef typename graph_traits<Graph>::out_edge_iterator out_edge_iterator;
64 typedef typename edge_property<Graph>::type edge_property_type;
65 assert(u != uout);
66 std::pair<out_edge_iterator, out_edge_iterator> edges = g.out_edges(u);
67 bool palindrome = false;
68 edge_property_type palindrome_ep;
69 for (out_edge_iterator e = edges.first; e != edges.second; ++e) {
70 vertex_descriptor v = target(*e, g);
71 vertex_descriptor vc = get(vertex_complement, g, v);
72 if (vc == u) {
73 // When ~v == u, adding the edge (~v,~u), which is (u,~u),
74 // would invalidate our iterator. Add the edge after this
75 // loop completes.
76 palindrome = true;
77 palindrome_ep = g[*e];
78 } else
79 g.add_edge(uout, v, g[*e]);
80 }
81 if (palindrome) {
82 vertex_descriptor uc = get(vertex_complement, g, u);
83 vertex_descriptor uoutc = get(vertex_complement, g, uout);
84 g.add_edge(uout, uc, palindrome_ep);
85 g.add_edge(uout, uoutc, palindrome_ep);
86 }
87}
88
89/** Add the incoming edges of vertex u to vertex v. */
90template<typename Graph>

Callers 2

copy_in_edgesFunction · 0.85
mergeFunction · 0.85

Calls 3

getFunction · 0.70
out_edgesMethod · 0.45
add_edgeMethod · 0.45

Tested by

no test coverage detected