#### How to remove a edge from a graph in c++?

everyone. I have any problem with a graph. I create a graph, and I want to write a functions which remove edges and check if a edge is exist. A program shows any error, so I make somewhere any error.I hope someone help me resolve this problem. This is a task at school, This task is really hard for me.I just begin learn to C++.

``````        class Node{
int n;
int weight;
string label;
public:
Node(int, int, string);
operator int() { return n; }
int get_nr() const { return n;
int get_w() const { return weight; }
string sh_node();
};

Node::Node(int nr, int w = 1, string lb="unknown"){
n = nr;
weight = w;
label = lb;
}

string Node::sh_node(){
}

typedef vector<Node> node_vector;
typedef vector<node_vector*> pnt_vector;

class Graph
{
bool directed;
pnt_vector pointers;
public:
Graph(int, bool);
Graph(const Graph &g);
~Graph();
bool is_edge(Node, Node) const;
bool rem_edge(Node p, Node q) const;
string sh_graph() const;
};

Graph::Graph(int nodes = 1, bool d = false){
directed = d;
for(int i=0; i<nodes; i++){
pointers.push_back(new node_vector);
pointers.at(i)->push_back(i);
}
}
Graph::~Graph(){

}

string Graph::sh_graph() const{
string tmp = "";
for(int i=0; i<pointers.size(); i++){
if(i<10) tmp += ' ';
tmp += to_string(i) + ": ";
for(int j=1; j<pointers[i]->size(); j++)
tmp += pointers[i]->at(j).sh_node() + ", ";
tmp += 'n';
}
return tmp;
}

bool Graph::add_edge(Node p, Node q, int w=1) const{
if(!is_edge(p,q) && p<pointers.size() && q<pointers.size()){
pointers[p]->push_back(Node(q,w));
if(!directed) pointers[q]->push_back(Node(p,w));
return true;
}
return false;
}

bool Graph::is_edge(Node, Node) const{
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++)
isEdge[i][j] = true;
return false;
}
bool rem_edge(Node p, Node q) const{

int cnt = 0;
for (int i = 1; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (cnt < k) {
remEdge[i][j] = false;
cnt++;
}
}
}
}
``````

Source: Windows Questions C++