本文整理汇总了C++中GEdge::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ GEdge::Next方法的具体用法?C++ GEdge::Next怎么用?C++ GEdge::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GEdge
的用法示例。
在下文中一共展示了GEdge::Next方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
GEdge *GNode< Point >::Search( Long n, Long i ) const {
GEdge *p;
for (p=adjacents; p != NULL; p=p->Next())
if (( p->Item() == i) && (p->Node() == n))
break;
return p;
}
示例2: while
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;
}
示例3: Neighbours
GEdge *GNode< Point >::Del( Long n, Long i ) {
GEdge *p = Neighbours();
GEdge *q;
if (!p) return NULL;
if ((p->Node()==n)&&(p->Item()==i)) {
q=p->Next();
etrash.push_back(p);
// delete(p); // Problem when using Neighbours() list: cannot delete
adjacents=q;
} else {
for (q=p->Next();q != NULL; p=q,q=q->Next())
if (q && (q->Node() ==n) && (q->Item() == i)) {
p->Next(q->Next());
etrash.push_back(q);
break;
// delete(q); // Problem when using Neighbours() list: cannot delete
}
}
return adjacents;
}
示例4: Unlink
/*
* Merges 2 nodes in 1 ->n1
* Updates the adjacent list of all node (n2 ->n1).
* and delete n2.
*/
Errc Graph2d::Merge( Long n1, Long n2 ) {
GEdge *ptr;
if (_directed) {
// std::cerr << "Error: Merge is not implemented for directed graphs." << std::endl;
// return FAILURE;
if ((n1==n2) || (!tnode[n1]) || (!tnode[n2])) return FAILURE;
// Remove links
Unlink(n1,n2);
Unlink(n2,n1);
while((ptr=tnode[n2]->Neighbours())){
if ( n2 != ptr->Node() )
Link(n1,ptr->Node(),ptr->Item(),ptr->weight,true);
else
Link(n1,n1,ptr->Item(),ptr->weight,true);
Unlink(n2,ptr->Node(),ptr->Item());
}
// Cross the graph in order to replace n2 by n1
for ( int i = 0; i < this->Size(); ++i ) {
const GNode<Point2d> * noeud = (*this)[i];
if ( noeud != NULL ) {
for ( ptr = noeud->Neighbours() ; ptr != NULL; ptr = ptr->Next() )
if ( ptr->Node() == n2 ) {
Link(i,n1,ptr->Item(),ptr->weight,true);
Unlink(i,n2,ptr->Item());
}
}
}
Del(n2);
} else {
if ((n1==n2) || (!tnode[n1]) || (!tnode[n2])) return FAILURE;
Unlink(n1,n2);
while((ptr=tnode[n2]->Neighbours())){
if ( n2 != ptr->Node() )
Link(n1,ptr->Node(),ptr->Item(),ptr->weight,true);
else
Link(n1,n1,ptr->Item(),ptr->weight,true);
Unlink(n2,ptr->Node(),ptr->Item());
}
Del(n2);
}
return SUCCESS;
}
示例5: New
/*
* Creates a copy of graph g.
*/
Graph3d &Graph3d::operator=( const Graph3d &g ) {
Long i;
GEdge *l;
New(g.size,g.ndep,g.nrow,g.ncol);
for (i=0; i<size; i++){
if (g[i] != NULL){
Add(i,g[i]->Item(),g[i]->seed);
tnode[i]->value=g[i]->value;
for (l=g[i]->Neighbours(); l!=NULL; l=l->Next()){
if (i>l->Node())
Link(i,l->Node(),l->Item(),l->weight);
}
}
}
return *this;
}
示例6: getIncidentEdges
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;
}