MCPcopy Create free account
hub / github.com/davisking/dlib / copy_graph

Function copy_graph

dlib/graph_utils/graph_utils.h:358–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356 typename graph_type2
357 >
358 typename enable_if<is_graph<graph_type1> >::type copy_graph (
359 const graph_type1& src,
360 graph_type2& dest
361 )
362 {
363 COMPILE_TIME_ASSERT(is_graph<graph_type1>::value);
364 COMPILE_TIME_ASSERT(is_graph<graph_type2>::value);
365 if (graph_helpers::is_same_object(src,dest))
366 return;
367
368 copy_graph_structure(src,dest);
369
370 // copy all the node and edge content
371 for (unsigned long i = 0; i < src.number_of_nodes(); ++i)
372 {
373 dest.node(i).data = src.node(i).data;
374
375 for (unsigned long j = 0; j < src.node(i).number_of_neighbors(); ++j)
376 {
377 const unsigned long nidx = src.node(i).neighbor(j).index();
378 if (nidx >= i)
379 {
380 dest.node(i).edge(j) = src.node(i).edge(j);
381 }
382 }
383 }
384 }
385
386 template <
387 typename graph_type1,

Callers 3

test_copyFunction · 0.85
test_copyFunction · 0.85

Calls 7

copy_graph_structureFunction · 0.85
neighborMethod · 0.80
number_of_childrenMethod · 0.80
is_same_objectFunction · 0.70
number_of_nodesMethod · 0.45
number_of_neighborsMethod · 0.45
indexMethod · 0.45

Tested by 2

test_copyFunction · 0.68
test_copyFunction · 0.68