-
-
Notifications
You must be signed in to change notification settings - Fork 111
Add SimpleCycles function #39
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
There should be a
SimpleCyclesstandalone function that detects all simple cycles in a given graph.Analogous to functions like
StronglyConnectedComponents,SimpleCyclesshould store the hashes of the vertices that form a cycle as a[]Kand return all of them as a slice, so that the return type is[][]K.Example
In the graph shown above, there are two cycles: 1-2-4 and 2-3-5. This is how
SimpleCycleshould look and work like:The function signature should be
SimpleCycles[K comparable, T any](g Graph[K, T]) ([][]K, error).