An open API service indexing awesome lists of open source software.

https://github.com/triska/scc

Strongly Connected Components of a Graph
https://github.com/triska/scc

graph prolog scc tarjan-algorithm

Last synced: 3 months ago
JSON representation

Strongly Connected Components of a Graph

Awesome Lists containing this project

README

          

Relation between a graph and its Strongly Connected Components (SCCs).

Usage:

nodes_arcs_sccs(+Ns, +As, -SCCs)

where:

* `Ns` is a list of nodes. Each node must be a ground term.
* `As` is a list of `arc(From,To)` terms where `From` and `To` are nodes.
* `SCCs` is a list of lists of nodes that are in the same strongly
connected component.

Running time is `O(|V| + log(|V|)*|E|)`.

Example:

```
?- nodes_arcs_sccs([a,b,c,d], [arc(a,b),arc(b,a),arc(b,c)], SCCs).
SCCs = [[a,b],[c],[d]].
```