tnode.cc

来自「it is very important」· CC 代码 · 共 54 行

CC
54
字号
// Test nodes for testing routing algorithms// George F. Riley, Georgia Tech, Winter 2000#include <stdio.h>#include "tnode.h"void Node::AddAdj( nodeid_t a, int w){  Edge* pE;  pE= new Edge(a, w);  m_Adj.push_back(pE);}const NodeWeight_t Node::NextAdj( const NodeWeight_t& last){Edge* pE;  static EdgeVec_it prev;  if (last.first == NODE_NONE)    {      prev = m_Adj.begin();      pE = *prev;      if(0)printf("NextAdj returning first edge %ld w %d\n",             pE->m_n, pE->m_w);      return(NodeWeight_t(pE->m_n, pE->m_w));    }  else    { // See if last is prev      if (last.first == (*prev)->m_n)        { //Yep, just advance iterator          prev++;          if (prev == m_Adj.end())            { // No more              return(NodeWeight_t(NODE_NONE, 0));            }          else            {              pE = *prev;              if(0)printf("NextAdj returning next edge %ld w %d\n",                     pE->m_n, pE->m_w);              return(NodeWeight_t(pE->m_n, pE->m_w));            }        }      else        { // Need to code this          printf("Non-linear advance of NextAdj\n");          exit(1);        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?