|
template<typename CONTAINER , typename TYPE , typename ITERATOR > |
ITERATOR | chooseIteratorByFastTest (CONTAINER &container, std::function< bool(const TYPE &)> includeElement) |
|
template<typename CONTAINER , typename TYPE , typename ITERATOR > |
ITERATOR | chooseIteratorBySlowTest (CONTAINER &container, std::function< bool(const TYPE &)> includeElement, int size) |
|
template<typename CONTAINER , typename TYPE , typename ITERATOR > |
ITERATOR | chooseIteratorFrom (CONTAINER &container, std::function< bool(const TYPE &)> includeElement, bool isFastTest) |
| Returns an iterator to a random element in the container . More...
|
|
template<> |
void | getAllEdges (const Graph &G, Array< edge > &edges) |
|
template<typename CONTAINER > |
void | getAllEdges (const Graph &G, CONTAINER &edges) |
|
template<> |
void | getAllNodes (const Graph &G, Array< node > &nodes) |
|
template<typename CONTAINER > |
void | getAllNodes (const Graph &G, CONTAINER &nodes) |
|
template<typename CONTAINER , typename TYPE , typename ITERATOR >
ITERATOR ogdf::internal::chooseIteratorFrom |
( |
CONTAINER & |
container, |
|
|
std::function< bool(const TYPE &)> |
includeElement, |
|
|
bool |
isFastTest |
|
) |
| |
Returns an iterator to a random element in the container
.
Takes linear time (given that includeElement
runs in constant time). An invalid iterator is returned iff no feasible element exists. When includeElement
has a non-constant runtime it is recommended to set isFastTest
to false
.
- Template Parameters
-
CONTAINER | Type of the container. Any iterable container that implements size() is applicable. |
TYPE | Type of elements returned by the iterator of the container. |
- Parameters
-
container | The container that we want to pick an element from. |
includeElement | Specifies for each element whether it is feasible to be chosen. Defaults to all elements being feasible. Must return the same value when called twice with the same element. |
isFastTest | Should be set to false to prevent querying the same element multiple times for feasibility. Note that this will result in additional space allocated linear in the size of the container. |
- Returns
- An iterator to the picked element or an invalid iterator if no such element exists.
Definition at line 188 of file list_templates.h.