예제 #1
0
GEdge * Graph::getEdge(long firstNode, long secondNode){
   GEdge *p = tnode[firstNode]->getIncidentEdges();
   while(p){
      if (p->IncidentNode() == secondNode)
	 return p;
      else
	 p=p->Next();
   }
   return NULL;      
}
예제 #2
0
GEdge *GNode::UnConnect( long incidentNode ) {
   GEdge *p = getIncidentEdges();
   GEdge *q;
   
   if (!p) return NULL;
   if(p->IncidentNode() == incidentNode){
      adjacents = p->Next();
      delete p;
   }
   return adjacents;
   
   while (p->Next())
      {
	 if(p->Next()->IncidentNode() == incidentNode){
	    q = p->Next();
	    p->Next(q->Next());
	    delete q;
	 }else
	    p = p->Next();
      }
   return adjacents;
}