⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 allpath.cpp

📁 次界面好用但是也可能有许多不足还希望有贤人志士指点迷津!
💻 CPP
字号:
#include"traffic.h"
void AllPath(ALGraph g, int from, int to,StrARR path, int &i)
{
int m,j;
ArcNode *p;
extern visited[];

for(m = 0 ; path[i][m]!=-1 ;m++); /* Add "from" to the path*/
path[i][m] = from;

visited[from] = TRUE;
if(from == to)  /*search  the  line*/
{ 
i++;
for(m = 0;path[i-1][m]!=-1;m++)
path[i][m] = path[i-1][m];
}
else
 for(p = g.vertices[from].firstarc;p;p = p->nextarc)
  {         /*DFS trave*/
    if(!visited[p->adjvex])
    AllPath(g,p->adjvex,to,path,i);
  }
  
visited[from] = FALSE;

for(m = 0; path[i][m] != from && path[i][m]!=-1; m++);  /*delete "from" from the path*/
path[i][m] = -1;
}

⌨️ 快捷键说明

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