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 {
92 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
94 if (!ascendingOrder) {
95 reverse(sequenceCopy.begin(),sequenceCopy.end());
98 copyIterator=sequenceCopy.begin();
110 LessThan tmp(metric);
111 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
113 if (!ascendingOrder) {
114 reverse(sequenceCopy.begin(),sequenceCopy.end());
117 copyIterator=sequenceCopy.begin();
129 LessThanEdgeTargetMetric tmp(sg,metric);
130 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
132 if (!ascendingOrder) {
133 reverse(sequenceCopy.begin(),sequenceCopy.end());
136 copyIterator=sequenceCopy.begin();
148 LessThanEdgeSourceMetric tmp(sg,metric);
149 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
151 if (!ascendingOrder) {
152 reverse(sequenceCopy.begin(),sequenceCopy.end());
155 copyIterator=sequenceCopy.begin();
167 LessThanEdgeExtremitiesMetric tmp(sg,metric);
168 sort(sequenceCopy.begin(),sequenceCopy.end(),tmp);
170 if (!ascendingOrder) {
171 reverse(sequenceCopy.begin(),sequenceCopy.end());
174 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.