An algorithm for finding the edges of all rings in a marked graph

topic description

it is known that there is a graph consisting of several connected components, and now it is required to mark the edges of all rings in the graph. The example diagram is as follows: (that is, marked with red edges)

clipboard.png

kruskal
DFS

clipboard.png

I"d like to ask if there is any other better algorithm.

Mar.23,2022

thought for a moment that breadth first might be more appropriate

clipboard.png


Baidu [connected component algorithm of undirected graph] is an important part of graph theory algorithm.


the directed graph is directly topologically sorted and then the undeleted edge markers are found.

Menu