问题描述:

I want to write program in haskell which will find the maximum flow in a flow network. However, I don't know Haskell well, so I don't know what is the best way to do it.

My biggest problem is finding augmenting path.

In Java I would create array of booleans Visited (to know which Node is visited) and residual graph rGraph and using DFS I would find augmenting paths (if there were some).

But in Haskell...

That's my definition of type Graph.

type Node = Char

type Edge = (Node ,Node, Int)

type Graph = ([Node], [Edge])

So graph with 5 nodes and 6 edges I can represent this way

 ['a','b','c','d','e'], [('a','b',7),('b','c',4),('a','d',8),('c','d',9),('e','b',11),('d','e',3)]

I can try to do it "java style", but I think there is a better way.

What is the best way to find augmenting path in graph in haskell?

相关阅读:
Top