A simple implementation for detecting loops in a directed graph in C #

I wonder if you can help me with a simple implementation for detecting loops in a directed graph in C #.

I read about algorithms , but I would like to find something already implemented, very simple and short.

I don't need performance because the data size is limited.

+6
source share
2 answers

Run DFS on G and check for support.

In each node, you are expanding, just checking to see if it is already on the stream path.

+2
source

Check out QuickGraph - it has many implemented algorithms, and it is a pretty good library to use.

+1
source

Source: https://habr.com/ru/post/891009/


All Articles