Haskell - generating all paths between nodes
- by user1460863
I need to build a function, which return all paths between certain nodes.
connect :: Int -> Int-> [[(Int,Int)]]
Data.Graph library gives me usefull function 'buildG' which builds graph for me. If I call
let g = buildG (1,5) [(1,2),(2,3),(3,4),(4,5),(2,5)],
I will get an array where every node is mapped to his neighbours.
An example:
…