20 #ifndef TULIP_SORTITERATOR_H 21 #define TULIP_SORTITERATOR_H 24 #include <tulip/Iterator.h> 25 #include <tulip/StableIterator.h> 26 #include <tulip/NumericProperty.h> 27 #include <tulip/Graph.h> 28 #include <tulip/Vector.h> 38 bool operator() (
const node &n1,
const node &n2)
const {
41 bool operator() (
const edge &e1,
const edge &e2)
const {
46 struct LessThanEdgeTargetMetric {
48 metric(metric), sg(sg) {
50 bool operator() (
const edge &e1,
const edge &e2)
const {
58 struct LessThanEdgeSourceMetric {
60 metric(metric), sg(sg) {
62 bool operator() (
const edge &e1,
const edge &e2)
const {
70 struct LessThanEdgeExtremitiesMetric {
72 metric(metric), sg(sg) {
74 bool operator() (
const edge &e1,
const edge &e2)
const {
75 std::pair<node, node> ends = sg->ends(e1);
94 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
96 if (!ascendingOrder) {
97 reverse(sequenceCopy.begin(),sequenceCopy.end());
100 copyIterator=sequenceCopy.begin();
112 LessThan tmp(metric);
113 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
115 if (!ascendingOrder) {
116 reverse(sequenceCopy.begin(),sequenceCopy.end());
119 copyIterator=sequenceCopy.begin();
131 LessThanEdgeTargetMetric tmp(sg,metric);
132 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
134 if (!ascendingOrder) {
135 reverse(sequenceCopy.begin(),sequenceCopy.end());
138 copyIterator=sequenceCopy.begin();
150 LessThanEdgeSourceMetric tmp(sg,metric);
151 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
153 if (!ascendingOrder) {
154 reverse(sequenceCopy.begin(),sequenceCopy.end());
157 copyIterator=sequenceCopy.begin();
169 LessThanEdgeExtremitiesMetric tmp(sg,metric);
170 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
172 if (!ascendingOrder) {
173 reverse(sequenceCopy.begin(),sequenceCopy.end());
176 copyIterator=sequenceCopy.begin();
This Iterator sorts the nodes in a sequence based on their values in a NumericProperty.
This Iterator sorts the edges based on the values of their target nodes in a NumericProperty.
virtual double getNodeDoubleValue(const node n) const =0
Returns the value associated with the node n in this property.
This Iterator sorts the edges based on the values of their source nodes in a NumericProperty.
Interface all numerical properties. Property values are always returned as double.
This Iterator sorts the edges in a sequence based on their values in a NumericProperty.
This Iterator sorts the edges based on the values of their extremities nodes in a NumericProperty...
virtual double getEdgeDoubleValue(const edge e) const =0
Returns the value associated with the edge e in this property.