Hello!
I´m trying to implement a graph,that is supposed to calculate the shortest distance from a city to another city,using Dijkstra's algorithm.
I need to be able to read from a file containing the name of the citys,and read in from another file containing the name of the citys+distance between em.
for example:
London manchester 400
got this "template" to work with:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class Graph
{
private:
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;
};
Supposed to use a 2D array for this..
Have no clue how to start,hope someone can give me some pointers in the right direction..