[Haskell-cafe] Traversing a graph in STM

Einar Karttunen ekarttun at cs.helsinki.fi
Wed Sep 13 03:37:39 EDT 2006


Hello

Is there an elegant way of traversing a directed graph in STM?

type Node  nt et = TVar (NodeT nt et)
type Edge  et    = TVar et
data NodeT nt et = NodeT nt [(Node nt et, Edge et)]

type MyGraph = Node String Int

When implementing a simple depth first search we need a way to
mark nodes (= TVars) as visited. In addition multiple concurrent
searches should be possible.

Is it possible to avoid passing around an explicit Set of visited
nodes? And is there a better way of getting TVar identity than
StableNames?

- Einar Karttunen


More information about the Haskell-Cafe mailing list