#include "graph.h" graph::graph() : directed(false) { } graph::graph(bool dir) : directed(dir) { } int graph::addVertex(const char* vert) { return vtxlst.addVertex(vert, adjList, adjMatrix); } bool graph::addEdge(const char* src, const char* dest, double weight, bool dir) { return edglst.addEdge(src, dest, weight, vtxlst, adjList, adjMatrix, dir); } void graph::displayVertices() const { cout << vtxlst << '\n'; } void graph::displayEdges() const { for (unsigned int i=0; i " << vtxlst.getVertexName(e.to) << " (" << e.weight << ")\n"; } } unsigned int graph::getVertexListSize() const { return vtxlst.size(); } unsigned int graph::getEdgeListSize() const { return edglst.size(); } void graph::displayAdjacencyList() const { for (unsigned int i=0; i0) cout << ", "; cout << "-->" << vtxlst.getVertexName(adjList[i][j].to) << " (" << adjList[i][j].weight << ")"; } cout << '\n'; } } } void graph::displayAdjacencyMatrix() const { unsigned int i, j; cout << " "; for (i=0; i > minPath; vector minWeight; vector weightFound; for (i=0; i* vint = new vector(); minPath.push_back(*vint); double wgt = adjMatrix[posSrc][i]; if (wgt == 0.0) wgt = DOUBLE_MAX; else { if ((int) i != posSrc) minPath[i].push_back(posSrc); minPath[i].push_back(i); } minWeight.push_back(wgt); weightFound.push_back(false); } minWeight[posSrc] = 0; weightFound[posSrc] = true; for (i=0; i