📄 tnode.cc
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -