Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Graph.h
- * Inlรคmning 3B
- *
- * Created by Sebastian Norling on 2011-04-26.
- * Copyright 2011 Sebastian Norling. All rights reserved.
- *
- */
- #ifndef GRAPH_H
- #define GRAPH_H
- #include <string>
- using namespace std;
- class Graph
- {
- private:
- string* cities;
- int** relations;
- int nrOfNodes;
- void clear();
- void copy(const Graph& g);
- void initRelations(int n);
- int getCityPos(string city) const;
- int getNextNodeToVisit(int distance[], bool visited[]) const;
- void readCitiesFromFile(string filename);
- void readRelationsFromFile(string filename);
- public:
- Graph();
- Graph(string cities[], int n);
- Graph(const Graph& g);
- virtual ~Graph();
- Graph &operator=(const Graph& g);
- void addEdge(string from, string to, int distance);
- bool removeEdge(string from, string to);
- bool hasEdge(string from, string to) const;
- int shortestPath(string from, string to) const;
- void printShortestPath(string from, string to) const;
- int getNumberOfNodes() const;
- void printAllRelations() const;
- void readFromFile(string citiesFile, string relationsFile);
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement