47 lines
953 B
C++
47 lines
953 B
C++
#ifndef GRAPH_H
|
|
#define GRAPH_H
|
|
|
|
#include<iostream>
|
|
#include <vector>
|
|
|
|
class GraphEdge;
|
|
|
|
class GraphNode
|
|
{
|
|
std::vector<GraphEdge> m_neighbours;
|
|
int m_testvalue; //temp variable
|
|
float m_priority;
|
|
|
|
public:
|
|
GraphNode();
|
|
GraphNode(std::vector<GraphEdge>);
|
|
|
|
std::vector<GraphEdge> getNeighbours();
|
|
void addNeighbours(GraphNode*,float);
|
|
void addNeighbours(GraphEdge);
|
|
int getNbNeighbours();
|
|
virtual float heuristic(GraphNode*){
|
|
std::cout << "WARNING : You're using the default heuristic. For better result, redefine the heuristic function in GraphNode." << std::endl;
|
|
return 0;
|
|
};
|
|
|
|
void setValue(int);
|
|
int getValue();
|
|
void setPriority(float);
|
|
float getPriority();
|
|
void print(std::string prefix);
|
|
};
|
|
|
|
class GraphEdge
|
|
{
|
|
GraphNode* m_target;
|
|
float m_weight;
|
|
|
|
public:
|
|
GraphEdge(GraphNode*,float);
|
|
GraphNode* getTarget();
|
|
float getWeight();
|
|
};
|
|
|
|
#endif // GRAPH_H
|