20 #ifndef TULIP_SORTITERATOR_H
21 #define TULIP_SORTITERATOR_H
26 #include <tulip/Iterator.h>
27 #include <tulip/StableIterator.h>
28 #include <tulip/NumericProperty.h>
29 #include <tulip/Graph.h>
30 #include <tulip/Vector.h>
39 bool operator()(
const node &n1,
const node &n2)
const {
42 bool operator()(
const edge &e1,
const edge &e2)
const {
47 struct LessThanEdgeTargetMetric {
49 : metric(metric), sg(sg) {}
50 bool operator()(
const edge &e1,
const edge &e2)
const {
60 struct LessThanEdgeSourceMetric {
62 : metric(metric), sg(sg) {}
63 bool operator()(
const edge &e1,
const edge &e2)
const {
73 struct LessThanEdgeExtremitiesMetric {
75 : metric(metric), sg(sg) {}
76 bool operator()(
const edge &e1,
const edge &e2)
const {
77 std::pair<node, node> ends = sg->ends(e1);
96 bool ascendingOrder =
true)
101 if (!ascendingOrder) {
117 bool ascendingOrder =
true)
119 LessThan tmp(metric);
122 if (!ascendingOrder) {
141 LessThanEdgeTargetMetric tmp(sg, metric);
144 if (!ascendingOrder) {
163 LessThanEdgeSourceMetric tmp(sg, metric);
166 if (!ascendingOrder) {
185 LessThanEdgeExtremitiesMetric tmp(sg, metric);
188 if (!ascendingOrder) {
210 template <
typename T,
typename CompareFunction>
214 sort(this->
sequenceCopy.begin(), this->sequenceCopy.end(), compFunc);
238 template <
typename T,
typename CompareFunction>
259 template <
typename Container,
typename CompareFunction>
260 typename std::enable_if<has_const_iterator<Container>::value,
261 SortIterator<typename Container::value_type, CompareFunction>
263 CompareFunction &&compFunc) {