list problem

help me out guys.
i have a problem of how to delete an adjacent Node in a graph.


Nodes(Vector)====>List-List-List
^
where the Nodes are vector type and the marked(with ^) nodes are list type


here is my program

class GraphNode
{private:
datatype NodeVal;
list<datatype> AdjList;
public:
GraphNode(datatype);
void AddAdjNode(datatype);
void Graph::AddEdge(datatype ,datatype );
friend class Graph;
};
class Graph
{private:
vector<GraphNode> Nodes;

public:
Graph(){};
void AddNode(datatype);
};


GraphNode::GraphNode(datatype u)
{NodeVal =u;}

void GraphNode::AddAdjNode(datatype u)
{AdjList.push_back(u);}

void Graph::AddNode (datatype u)
{ GraphNode P(u);
Nodes.push_back(P);

}
void Graph::AddEdge(datatype u,datatype v)
{ if (!(IsEmptyGraph()))
if (IsMember(u) && (IsMember(v)))
{ int indexu = NodeIndex(u);
Nodes[indexu].AddAdjNode(v);
}
}

so help me how can i delete an adjacent node, from nodes[i], of which is adjacent to it
too, how can i add unique nodes in the function AddNode
Last edited on
I don't get the question.
What are you asking? How to delete the vector, how to delete the individual elements of the vector, or how to make sure that no node is pointing to a deleted node?
I agree. Please post an example showing us how you are constructing the nodes. You don't have to show the whole program. A simple main demonstrating how your nodes are created and added to a list would be helpful. I really have no idea what you are asking.
Topic archived. No new replies allowed.