Skip to content

A small pure implementation of Tarjan's strongly connected components algorithm (for use in detecting cycles) in the Mercury logical programming language.

License

Notifications You must be signed in to change notification settings

WhyNott/tarjan-mercury

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

tarjan-mercury

A small pure implementation of Tarjan's strongly connected components algorithm (for use in detecting cycles) in the Mercury logical programming language.

The cycles can be detected using the tarjan(in, in, out) predicate. It is polymorphic and should support vertices of any type (as long as it can be compared/unified normally). Edges are represented by a list of pairs of verticies.

Implementation is done by passing along a state variable through the program. Very tedious, but I needed this working.

Its probably not very efficient, but if I did not mess anything up, it should find all cycles within O(V + E) time. If I did mess something up, do let me know.

About

A small pure implementation of Tarjan's strongly connected components algorithm (for use in detecting cycles) in the Mercury logical programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published