[Haskell-beginners] Doing a DFS from scratch ....

Claudio Cesar de Sa ccs1664 at gmail.com
Tue Oct 20 22:36:08 UTC 2020


Hi everyone

Initially, I hope that this list is active yet.  For some days,
I had been trying to do a Depth First Search on a graph from scratch
following something very didactical (clear, elegant - legible, any worry
about efficiency).

This DFS keeps a boolean list to mark the nodes already visited and another
with current or valid nodes ( the stack of DFS classic).

The code is naive and well documented and is here:

https://github.com/claudiosa/CCS/blob/master/haskell/dfs_graph.hs
(excessively commented)

but unfortunately, it is not working.  My guess is  that the problem starts
on *new_node* function.  I am not sure if in DFS, when a current node gets
a next neighbour to stack, it gets all the neighbours.
In this code, it is getting one node per time.

The functions next_node and one_node seem very non-sense. Could someone
help me?

Thanks in advance



claudio

****************************************************************
************

*Whatsapp: +55 47 992451825 <%2B55%2047%2092451825>*
https://claudiocesar.wordpress.com/ (my links HERE)
https://github.com/claudiosa
https://www.udemy.com/picat-uma-linguagem-de-programacao-multiparadigma/
****************************************************************
*************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20201020/7f91e8c5/attachment.html>


More information about the Beginners mailing list