summaryrefslogtreecommitdiffstats
path: root/labb3/tsp/src/Tour.h
blob: 7b47240d04f147309d1110a09fc2366b219460a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * TDDD86 Lab 3b - gusso230 (group 11)
 * This file contains the tour structure.
 * You can insert points using two algorithms (nearest neighbour and smallest
 * increase), get the total length of the tour and draw the tour.
 */
#ifndef TOUR_H
#define TOUR_H

#include "Node.h"
#include "Point.h"

class Tour {
public:
    Tour();                                 // create an empty tour
    ~Tour();                                // free all nodes
    void show() const;                      // print the tour to stdout
    void draw(QGraphicsScene *scene) const; // draw the tour on `scene`
    int size() const;                       // return number of points on tour
    double distance() const;                // return total distance of tour
    void insertNearest(Point p);            // insert `p` using nearestNeighbour
    void insertSmallest(Point p);           // insert `p` using smallestIncrease

private:
    Node *first; // first node
};

#endif // TOUR_H