Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef AdjList_H_
- #define AdjList_H_
- #include <iostream>
- #include <cstdlib>
- #include <string>
- #include <vector>
- using namespace std;
- class Edge;
- struct Node
- {
- public:
- string id;
- vector<Edge*>* adj;
- int distance;
- Node* prev;
- Node(string name){
- this->id = name;
- adj = new vector<Edge*>;
- prev = NULL;
- }
- ~Node(){};
- };
- class Edge{
- public:
- Edge(Node* current, Node* next, int weight);
- ~Edge();
- private:
- Node* current; //first node
- Node* next; //next node
- Edge* adj; //pointing to first edge in the adj list
- int weight;
- };
- Edge::Edge(Node* current, Node* next, int weight){
- current = current;
- next = next;
- weight = weight;
- }
- Edge::~Edge(){}
- class Graph{
- public:
- Graph(vector<string> a);
- ~Graph();
- const int getNumOfNodes();
- const int returnEdges();
- void insertEdge(string name1, string name2, int weight);
- private:
- int numOfNodes;
- vector <Edge*> edges;
- vector <Node*> vertices;
- };
- Graph::Graph(vector<string>a){
- while(a.size() != 0){
- Node* temp = new Node(a.back());
- a.pop_back();
- vertices.push_back(temp);
- }
- }
- const int Graph::getNumOfNodes(){
- return numOfNodes;
- }
- const int Graph::returnEdges(){
- return edges.size();
- }
- void Graph::insertEdge(string name1, string name2, int weight){
- }
- Graph::~Graph()
- {
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement