日常说明:首先博主也是菜鸟一枚,有错误欢迎大家指正。另外本博客所有的代码博主编写后均调试
通过。重要提醒!!!!博主使用的是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
{