Help me write a piece of c++ code to implement topological sorting

#include <stdio.h> #include <stdlib.h>

// Define the maximum number of vertices #define MAX_VERTEX_NUM 20 // Define infinity #define INFINITY 65535

// Define the adjacency matrix int arc[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; // Define an array to store the indegree of the node indegree[MAX_VERTEX_NUM]; // Define an array to store the results of topological sorting int tops[MAX_VERTEX_NUM];

//Initialize the adjacency matrix, indegree array void Init(in

Guess you like

Origin blog.csdn.net/weixin_42576410/article/details/129553502