Advertisement

拓扑排序C++源代码(完整算法)

阅读量:
复制代码
    #include<stdlib.h>
    #include<iostream>
    #include<vector>
    #include<queue>
    #include<stack>
    #include<limits>
    #include<algorithm>
    #include<math.h>
    #pragma warning(disable:4996)
    using namespace std;
    
    /*
    	1.
    		AOV网(Activity On Vertex Network)【顶点——表示活动】
    		是一个——有向无回路的图
    		顶点——表示活动
    		用弧——表示活动间的优先关系的有向图称为-顶点表示活动的网
    		即如果a->b,那么a是b的先决条件
    		求拓扑序列就是AOV
    	2.
    		用邻接矩阵存储时 每一列表示这个顶点的入度(有向图中)
    */
    //邻接矩阵存储,使用队列
    //5 6
    //0 1
    //0 2
    //1 3
    //2 1
    //2 4
    //3 4
    //拓扑序列为:0 2 1 3 4
    typedef struct GNode

全部评论 (0)

还没有任何评论哟~