387 Node t=target(e); |
387 Node t=target(e); |
388 changeTarget(e,source(e)); |
388 changeTarget(e,source(e)); |
389 changeSource(e,t); |
389 changeSource(e,t); |
390 } |
390 } |
391 |
391 |
|
392 /// Using this it is possible to avoid the superfluous memory |
|
393 /// allocation: if you know that the graph you want to build will |
|
394 /// be very large (e.g. it will contain millions of nodes and/or edges) |
|
395 /// then it is worth reserving space for this amount before starting |
|
396 /// to build the graph. |
|
397 /// \sa reserveEdge |
|
398 void reserveNode(int n) { nodes.reserve(n); }; |
|
399 |
392 /// \brief Using this it is possible to avoid the superfluous memory |
400 /// \brief Using this it is possible to avoid the superfluous memory |
393 /// allocation. |
401 /// allocation. |
394 |
402 |
395 ///Using this it is possible to avoid the superfluous memory |
403 /// Using this it is possible to avoid the superfluous memory |
396 ///allocation: if you know that the graph you want to build will |
404 /// allocation: if you know that the graph you want to build will |
397 ///contain at least 10 million nodes then it is worth reserving |
405 /// be very large (e.g. it will contain millions of nodes and/or edges) |
398 ///space for this amount before starting to build the graph. |
406 /// then it is worth reserving space for this amount before starting |
399 void reserveNode(int n) { nodes.reserve(n); }; |
407 /// to build the graph. |
400 |
408 /// \sa reserveNode |
401 /// \brief Using this it is possible to avoid the superfluous memory |
409 void reserveEdge(int m) { edges.reserve(m); }; |
402 /// allocation. |
|
403 |
|
404 ///Using this it is possible to avoid the superfluous memory |
|
405 ///allocation: see the \ref reserveNode function. |
|
406 void reserveEdge(int n) { edges.reserve(n); }; |
|
407 |
|
408 |
410 |
409 ///Contract two nodes. |
411 ///Contract two nodes. |
410 |
412 |
411 ///This function contracts two nodes. |
413 ///This function contracts two nodes. |
412 /// |
414 /// |