我如何检查是否有向图是无环? [英] How do I check if a directed graph is acyclic?

查看:145
本文介绍了我如何检查是否有向图是无环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查是否有向图是无环?而且怎么叫算法?我想AP preciate一个参考。

How do I check if a directed graph is acyclic? And how is the algorithm called? I would appreciate a reference.

推荐答案

我会尝试排序拓扑,如果​​你不能,那么它有个周期。

I would try to sort the graph topologically, and if you can't, then it has cycles.

这篇关于我如何检查是否有向图是无环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆