日常说明:首先博主也是菜鸟一枚,有错误欢迎大家指正。另外本博客所有的代码博主编写后均调试
通过。重要提醒!!!!博主使用的是VS2017,如果有低版本的小伙伴
最好新建空项目将此代码复制上去。
更多算法请关注我的算法专栏https://blog.youkuaiyun.com/column/details/20417.html
运行截图:

Toposort.h
#pragma once
#define Max 100
#include <iostream>
#include <cstdlib>
#include<stack>
typedef int indegree[Max];
using namespace std;
class ArcNode
{
public:
int Vnum;
int weight;
ArcNode *arc_next;
ArcNode()
{
this->arc_next = NULL;
}
ArcNode(int Vnum, ArcNode*arc_next = NULL)
{
this->arc_next = arc_next;
this->Vnum = Vnum;
this->weight = weight;
}
};
typedef struct VNode
{

本文介绍了如何使用C++通过邻接表数据结构来实现图,并详细讲解了图的拓扑排序算法。代码已在VS2017环境下调试通过,适合学习数据结构与算法的读者参考。
最低0.47元/天 解锁文章
1112

被折叠的 条评论
为什么被折叠?



