Re: A simple (?) graph algorithm
From: Hans Aberg (haberg.not.this_at_matematik.su.se)
Date: 04/24/04
- Previous message: Cl?ment: "SWI prolog and the Nth-Queens problem."
- In reply to: pimko: "A simple (?) graph algorithm"
- Next in thread: pimko: "Re: A simple (?) graph algorithm"
- Reply: pimko: "Re: A simple (?) graph algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 24 Apr 2004 19:22:21 +0200
In article <659e1cbf.0404182341.1d1eabd3@posting.google.com>,
profesorpimko@wp.pl (pimko) wrote:
>I have a directed graph ...
...
>What I need is a predicate like allconnected(X,List) that would give
>me a list of all vertices that are connected to X:
You need to be careful in defining exactly what "connected to" means in a
directed graph:
One answer is given by Tarjan's strongly connected components (SCC) algorithm:
http://www1.ics.uci.edu/~eppstein/161/960220.html#sca
Adapted to computing FIRST:
http://compilers.iecc.com/comparch/article/01-04-079
In this definition, vertex x connected to vertex y means that there is a
path from x to and one from y to x. This then defines an equivalence
relation, and its equivalence classes are called the SCC's of the directed
graph.
Hans Aberg
- Previous message: Cl?ment: "SWI prolog and the Nth-Queens problem."
- In reply to: pimko: "A simple (?) graph algorithm"
- Next in thread: pimko: "Re: A simple (?) graph algorithm"
- Reply: pimko: "Re: A simple (?) graph algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|