... | ... |
@@ -424,48 +424,67 @@ |
424 | 424 |
for (typename From::NodeIt it(from); it != INVALID; ++it) { |
425 | 425 |
nodeRefMap[it] = to.addNode(); |
426 | 426 |
} |
427 | 427 |
for (typename From::EdgeIt it(from); it != INVALID; ++it) { |
428 | 428 |
edgeRefMap[it] = to.addEdge(nodeRefMap[from.u(it)], |
429 | 429 |
nodeRefMap[from.v(it)]); |
430 | 430 |
} |
431 | 431 |
} |
432 | 432 |
}; |
433 | 433 |
|
434 | 434 |
template <typename Graph> |
435 | 435 |
struct GraphCopySelector< |
436 | 436 |
Graph, |
437 | 437 |
typename enable_if<typename Graph::BuildTag, void>::type> |
438 | 438 |
{ |
439 | 439 |
template <typename From, typename NodeRefMap, typename EdgeRefMap> |
440 | 440 |
static void copy(const From& from, Graph &to, |
441 | 441 |
NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) { |
442 | 442 |
to.build(from, nodeRefMap, edgeRefMap); |
443 | 443 |
} |
444 | 444 |
}; |
445 | 445 |
|
446 | 446 |
} |
447 | 447 |
|
448 |
/// Check whether a graph is undirected. |
|
449 |
/// |
|
450 |
/// This function returns \c true if the given graph is undirected. |
|
451 |
#ifdef DOXYGEN |
|
452 |
template <typename GR> |
|
453 |
bool undirected(const GR& g) { return false; } |
|
454 |
#else |
|
455 |
template <typename GR> |
|
456 |
typename enable_if<UndirectedTagIndicator<GR>, bool>::type |
|
457 |
undirected(const GR&) { |
|
458 |
return true; |
|
459 |
} |
|
460 |
template <typename GR> |
|
461 |
typename disable_if<UndirectedTagIndicator<GR>, bool>::type |
|
462 |
undirected(const GR&) { |
|
463 |
return false; |
|
464 |
} |
|
465 |
#endif |
|
466 |
|
|
448 | 467 |
/// \brief Class to copy a digraph. |
449 | 468 |
/// |
450 | 469 |
/// Class to copy a digraph to another digraph (duplicate a digraph). The |
451 | 470 |
/// simplest way of using it is through the \c digraphCopy() function. |
452 | 471 |
/// |
453 | 472 |
/// This class not only make a copy of a digraph, but it can create |
454 | 473 |
/// references and cross references between the nodes and arcs of |
455 | 474 |
/// the two digraphs, and it can copy maps to use with the newly created |
456 | 475 |
/// digraph. |
457 | 476 |
/// |
458 | 477 |
/// To make a copy from a digraph, first an instance of DigraphCopy |
459 | 478 |
/// should be created, then the data belongs to the digraph should |
460 | 479 |
/// assigned to copy. In the end, the \c run() member should be |
461 | 480 |
/// called. |
462 | 481 |
/// |
463 | 482 |
/// The next code copies a digraph with several data: |
464 | 483 |
///\code |
465 | 484 |
/// DigraphCopy<OrigGraph, NewGraph> cg(orig_graph, new_graph); |
466 | 485 |
/// // Create references for the nodes |
467 | 486 |
/// OrigGraph::NodeMap<NewGraph::Node> nr(orig_graph); |
468 | 487 |
/// cg.nodeRef(nr); |
469 | 488 |
/// // Create cross references (inverse) for the arcs |
470 | 489 |
/// NewGraph::ArcMap<OrigGraph::Arc> acr(new_graph); |
471 | 490 |
/// cg.arcCrossRef(acr); |
0 comments (0 inline)