I'm absolute newbie in Prolog and I'm struggling with this task:
"There is given a discontinuous graph on the input. Write Prolog program which on the output prints lists of every nodes of each graph component.:
Discontinuous graph on the input is represented by it's edges for example like this:
e(1,2).
e(2,4).
e(2,5).
e(3,6).
e(3,7).
e(7,8).
That means this particular graph have two components and on the output should be something like this:
[1,2,4,5],
[3,6,7,8].
I found on the net solution for similar problem - printing all graph nodes (http://www.tek-tips.com/viewthread.cfm?qid=1602084), but I can't even figure out how to modify this to apply it on my task to print each component of a discontinuous graph separately.
Thanks for any idea.