4 ms·
This algorithm operates on trees. But I've always wondered how one can create efficient algorithms operating on general graphs in a functional language such as
by amelius 11y ago
This algorithm operates on trees. But I've always wondered how one can create efficient algorithms operating on general graphs in a functional language such as Haskell?
For example, how would one write a fast version of Dijkstra's shortest path algorithm in Haskell?
- dottedmag 11y agoE.g. using a variation of zippers
- tel 11y agoUsing mutability. It's not a sin, just something to avoid when not strictly necessary. http://jspha.com/posts/mutable_algorithms_in_immutable_languges_part_1/ http://jspha.com/posts/mutable_algorithms_in_immutable_langu... http://jspha.com/posts/mutable_algorithms_in_immutable_languages_part_2/ http://jspha.com/posts/mutable_algorithms_in_immutable_langu... http://jspha.com/posts/mutable_algorithms_in_immutable_languages_part_3/ http://jspha.com/posts/mutable_algorithms_in_immutable_langu...