00001
00002
00003
00004
00005
00006 #ifndef ROUTEPLANNINGV2_GRAPH_H_
00007 #define ROUTEPLANNINGV2_GRAPH_H_
00008 #include <stdio.h>
00009 #include <assert.h>
00010 #include <string>
00011 #include <vector>
00012 #include <map>
00013 #include "./NodeExpanded.h"
00014 #include "./Edge.h"
00015 using std::vector;
00016 using std::string;
00017 using std::map;
00018
00019 class Graph
00020 {
00021 public:
00022 Graph();
00023 Graph(const Graph& orig);
00024 virtual ~Graph();
00025
00026 void addNode(NodeExpanded node);
00027 void addDummyNode(NodeExpanded node);
00028 void removeDummyNode();
00029
00030 void addEdge(int startId, int endId, int time);
00031
00032
00033 NodeExpanded* getNode(int id) const;
00034
00035 vector<Edge>* getInEdges(int nodeId) const;
00036
00037 vector<Edge>* getOutEdges(int nodeId) const;
00038
00039
00040 size_t getNumNodes() const;
00041
00042
00043 int findIdOfClosestNode(double latitude, double longitude);
00044
00045 NodeExpanded* getRandomNodeWithNeighbours();
00046
00047 void reduceToBiggestComponent();
00048
00049
00050 protected:
00051 void findBiggestConnectedSubgraph(vector<size_t>* biggestConnectedSubGraph);
00052 vector<NodeExpanded>* _nodes;
00053 vector<vector<Edge> >* _outgoingEdges;
00054 vector<vector<Edge> >* _incomingEdges;
00055 };
00056
00057 #endif // ROUTEPLANNINGV2_GRAPH_H_