C++ Coding Help with part of my graph program. Im just finding a hard time imple
ID: 3571946 • Letter: C
Question
C++ Coding Help with part of my graph program.
Im just finding a hard time implementing the program (the .cpp files).
Please leave a comment if you need more info
Here is what i have....
Edge.hpp/////////////////////////////////////////////////
ifndef Edge_hpp
#define Edge_hpp
#include <stdio.h>
class Edge {
public:
// start vertex's label
int start;
// end vertex's label
int end;
// the weight of this edge
int weight;
Edge(int start, int end, int weight);
};
#endif /* Edge_hpp */
////////////////////////////////////////
Edge.cpp/////////////
#include "Edge.hpp"
// please implement it
Edge::Edge(int start, int end, int weight) {
}
////////////////
Vertex.cpp////////////////////
// please implement it
#include "Vertex.hpp"
Vertex::edgeList
Vertex::Vertex(int label) {
label = lab;
}
void Vertex::connectTo(int end) {
}
/////////////////////////
Vertex.hpp\\\\\\\\
#ifndef Vertex_hpp
#define Vertex_hpp
#include <stdio.h>
#include <list>
#include <string>
#include <vector>
#include "Edge.hpp"
using namespace std;
class Vertex {
public:
// the label of this vertex
int label;
// using a linked-list to manage its edges which offers O(c) insertion
list<Edge> edgeList;
// init your vertex here
Vertex(int label);
// connect this vertex to a specific vertex (adding edge)
void connectTo(int end);
};
#endif /* Vertex_hpp */
Explanation / Answer
hi,
actual I need more information from you, that what extracting you are trying to do, on what basis you are connecting the nodes, are you looking for some algorithm to be implemented or are you looking for shortest path by connections?
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.