#include "digraph.h" #include digraph::digraph() { nextNode = graphNodes.begin(); } int digraph::getSize() { return graphNodes.size(); } void digraph::addNode(int n, int a) { node *foundNode = NULL; node *adjacentNode = NULL; vector::iterator i; for(i = graphNodes.begin(); i != graphNodes.end(); i++) { if(i->getKey() == n) { *foundNode = *i; } } if(foundNode == NULL) { foundNode = new node(n); } for(i = graphNodes.begin(); i != graphNodes.end(); i++) { if(i->getKey() == n) { *adjacentNode = *i; } } if(adjacentNode == NULL) { adjacentNode = new node(a); } graphNodes.push_back(*foundNode); }