Write a program to find the strongly connected components in a digraph.
Format of functions:
void StronglyConnectedComponents( Graph G, void (*visit)(Vertex V) );
where Graph is defined as the following:
typedef struct VNode *PtrToVNode;
struct VNode {
Vertex Vert;
PtrToVNode Next;
};
typedef struct GNode *Graph;
struct GNode {
int NumOfVertices;
int NumOfEdges;
PtrToVNode *Array;
};
Here void (*visit)(Vertex V) is a function parameter that is passed into StronglyConnectedComponents to handle (print with a certain format) each vertex that is visited. The function StronglyConnectedComponents is supposed to print a return after each component is found.
Sample program of judge:
#include <stdio.h>
#incl

该程序旨在检测有向图中的强连通组件。提供的格式说明了函数应该如何处理每个被访问的顶点,并且示例输入和输出展示了图的表示方式。输出顺序不是强制性的,只要找到的组件正确即可。
最低0.47元/天 解锁文章
233

被折叠的 条评论
为什么被折叠?



