below is my current code and i'm having trouble implementing the addvertex function, i'm not too sure where to start as i am fairly new to c++ any help would be appreciated. I was told using a map would be the simplest way of doing this.
the graph needs to compute the minimum spanning tree, depth and breadth first traversals, and implementing iterators.
the addvertex function will addthe passed vertex to the graph (with no edges).
#ifndef WEIGHTED_GRAPH_H
#define WEIGHTED_GRAPH_H
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <array>
#include <list>
#include <forward_list>
#include <deque>
#include <map>
template <typename vertex>
class weighted_graph {
private:
class graph_iterator {
private:
public:
graph_iterator(const weighted_graph &);
graph_iterator(const weighted_graph &, size_t);
~graph_iterator();
graph_iterator operator=(const graph_iterator&);
bool operator==(const graph_iterator&) const;
bool operator!=(const graph_iterator&) const;
graph_iterator operator++();
graph_iterator operator++(int);
const vertex operator*();
const vertex* operator->();
};
class neighbour_iterator {
private:
public:
neighbour_iterator(const neighbour_iterator&);
neighbour_iterator(const weighted_graph &, const vertex&);
neighbour_iterator(const weighted_graph &, const vertex&, size_t);
~neighbour_iterator();
neighbour_iterator operator=(const neighbour_iterator& it);
bool operator==(const neighbour_iterator&) const;
bool operator!=(const neighbour_iterator&) const;
neighbour_iterator operator++();
neighbour_iterator operator++(int);
const std::pair<vertex, int> operator*();
const std::pair<const vertex, int>* operator->();
};
public:
weighted_graph();
~weighted_graph();
void add_vertex(const vertex&);