Simple implementation for detecting cycles in a directed graph in C#
I wonder if you could help me with a simple implementation for detecting cycles in a directed graph in C#.
I've read about the algorithms but I'd like to find something already implemented, very simple and short.
I don't care about the performance because the data size is limited.
查看QuickGraph - 它有加载的算法实施,这是一个相当不错的图书馆使用。
Run a DFS on G and check for backedges.
At every node you expand just check if it is already in the currrent path.
链接地址: http://www.djcxy.com/p/53096.html下一篇: C#中有向图中检测周期的简单实现