[Haskell-cafe] fast graph algorithms without object identities
jmaessen at alum.mit.edu
Thu Jan 31 15:56:42 EST 2008
On Jan 31, 2008, at 5:39 AM, Henning Thielemann wrote:
> It seems that algorithms on graphs can be implemented particularly
> efficient in low-level languages with pointers and in-place updates.
> topological sort needs only linear time, provided that dereferencing
> pointers requires constant time. I could simulate pointer
> and pointer updates by Map yielding linear logarithmic time for
> topological sort. I wonder if it is possible to write a linear time
> topological sort using lazy evaluation, since the runtime system of
> Haskell implementations is a graph processor based on pointers.
If so, I'd love to see this written up; I think it may be publishable
if it isn't published already.
Note that even using ST techniques can take more than linear time,
given an arbitrary purely-functionally-defined graph as input. We
can't (eg) assume that each node contains a reference, or that they
are densely numbered, so we end up having to look them up in some
fashion (though using a hash table can be reasonably quick if we
uniquely number nodes).
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe