当前位置:网站首页>AOV network topology sorting
AOV network topology sorting
2022-06-10 18:11:00 【ScarboroughFair#】


AOV Network to solve the problem of topology sorting ,AOE Network to solve the critical path problem
AOV network
AOV The characteristics of the net

Topological sorting concept

The method of topological sorting



testing AOV The method of whether there is a ring in the network


Structure code involved
typedef struct EdgeNode // Side table node
{
int adjvex; // Adjacency region , Store the subscript corresponding to the vertex
int weight; // Used to store weights , You don't need
struct EdgeNoe* next; // Chain domain , Point to the next adjacent point
}EdgeNode;
typedef struct VertexNode // Vertex table node
{
int in; // Vertex penetration
int data; // Vertex domain , Store vertex information
EdgeNode* firstedge; // Side header pointer
}VertexNode,AdjList[MAXVEX];
typedef struct
{
AdjList adjList;
int numVertexes, numEdges; // The current number of vertices and edges in the graph
}graphAdjList,*GraphAdjList;
Status TopologicalSort(GraphAdjList GL)
{
EdgeNodde* e;
int i, k, gettop;
int top = 0; // Used for stack pointer subscript
int count = 0; // Used to count the number of output vertices
int *stack; // The stack building storage degree is 0 The summit of
stack = (int*)malloc(GL->numVertexes * sizeof(int));
for (i = 0; i < GL->numVertexes; i++)
{
if (GL->adjList[i].in == 0)
stack[++top] = i; // The degree of engagement is 0 The top of the stack
}
while (top != 0)
{
gettop = stack[top--]; // Out of the stack
printf("%d->", GL->adjList[gettop].data); // Print this vertex
count++; // Count the number of output vertices
for (e = GL->adjList[gettop].firstedge; e; e = e->next)
{
// Traverse this vertex arc table
k = e->adjvex;
if (!(--GL->adjList[k].in)) // take k The entry degree of vertex adjacency table No -1
stack[++top] = k; // if 0 The stack , So that the next cycle output
}
}
if (count < GL->numVertexes) // If count Less than the number of vertices , It shows that there is a ring
return ERROR;
else
return OK;
}
边栏推荐
- 最新好文 | 基于因果推断的可解释对抗防御
- Mmdetection build_ Optimizer module interpretation
- pands pd. Detailed parsing of dataframe() function
- Postman-接口测试工具
- 【FAQ】运动健康服务REST API接口使用过程中常见问题和解决方法总结
- 使用Canvas实现的噪音线条h5js特效
- YML file configuration parameter definition dictionary and list
- Adding rendererdata of URP with script
- Talk about those things about telecommuting, participate in the essay solicitation, receive the contribution fee and win the grand prize!
- js锚点定位可以扩展很多功能
猜你喜欢
随机推荐
Abbexa 8-OHdG CLIA 试剂盒解决方案
高数_第6章无穷级数__绝对收敛_条件收敛
关于cmake和gcc的安装的记录
What is image search
mmdetection之dataset类解读
Canvas大火燃烧h5动画js特效
Unity stepping on the pit record: if you inherit monobehavior, the constructor of the class may be called multiple times by unity. Do not initialize the constructor
基于注解和反射生成xml
Numpy - record
PMP考生,深圳2022年6月PMP考试地点有这些
玩轉Pytorch的Function類
4. ssh
Summary of all contents of cloud computing setup to ensure that a complete cloud computing server can be built, including node installation, instance allocation, network configuration, etc
js模糊阴影跟随动画js特效插件
训练时添加进度条的库--tqdm
一个WPF开发的打印对话框-PrintDialogX
高数_第6章无穷级数__正项级数的性质
盛最多水得容器
True thesis of information system project manager in the first half of 2022
JS special effect of canvas divergent particle H5 animation








