当前位置:网站首页>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;
}
边栏推荐
猜你喜欢

Mapbox GL development tutorial (11): loading line layers

Adding rendererdata of URP with script

Container containing the most water

Why 0.1+0.2=0.3000000000000004

云计算搭建全部内容总结,保证可以搭建一个完整的云计算服务器,包括节点安装、实例的分配和网络的配置等内容

yml文件配置参数定义字典和列表

淘宝短视频避坑指南系列之一--彻底了解淘宝短视频

pwnable start

mmdetection之dataloader构建

Abbexa丙烯酰胺-PEG-NHS说明书
随机推荐
用脚本添加URP的RendererData
Library for adding progress bar during training --tqdm
聊聊远程办公那些事儿,参与征文领稿费拿大奖!
Wireshark learning notes (I) common function cases and skills
AOE网关键路径
How will you integrate into the $20trillion "project economy" in five years
IP总结(TCP/IP卷1和卷2)
分享这位大神的WPF界面设计系列视频
Chunk extend: hit training lab13
Adding rendererdata of URP with script
pwnable start
踩坑了,BigDecimal 使用不当,造成P0事故!
Abbexa 1,3-二棕榈素 CLIA 试剂盒解决方案
Abbkine柱式法ExKine Pro动物细胞/组织总蛋白提取试剂盒
QTableWidget / QTableView实用技巧
Linear mobile chess
Vim常用命令总结
cocoeval函数使用
领导提拔你的原因,只有这点最真实,其他都是瞎扯!
第七部分:第二课 顾问通用技能-如何安装和卸载SAP ERP系统客户端