49 lines
813 B
C++
49 lines
813 B
C++
#include "graph.h"
|
|
|
|
#include <algorithm>
|
|
using namespace std;
|
|
|
|
GraphNode::GraphNode()
|
|
{
|
|
m_neighbours = vector<GraphNode*>();
|
|
}
|
|
|
|
GraphNode::GraphNode(vector<GraphNode*> neighbours):m_neighbours(neighbours)
|
|
{
|
|
}
|
|
|
|
void GraphNode::addNeighbours(GraphNode* node){
|
|
m_neighbours.push_back(node);
|
|
}
|
|
|
|
int GraphNode::getNbNeighbours(){
|
|
return m_neighbours.size();
|
|
}
|
|
|
|
vector<GraphNode*> GraphNode::getNeighbours(){
|
|
return m_neighbours;
|
|
}
|
|
|
|
void GraphNode::print(std::string prefix)
|
|
{
|
|
cout << prefix << "Node_id : ";
|
|
cout << prefix << m_testvalue << endl;
|
|
}
|
|
|
|
void GraphNode::setValue(int a){
|
|
m_testvalue = a;
|
|
}
|
|
|
|
int GraphNode::getValue(){
|
|
return m_testvalue;
|
|
}
|
|
|
|
void GraphNode::setPriority(float priority){
|
|
m_priority = priority;
|
|
}
|
|
|
|
float GraphNode::getPriority(){
|
|
return m_priority;
|
|
}
|
|
|