How do I implement graphs and graph algorithms in a functional programming language?

Posted by brad on Stack Overflow See other posts from Stack Overflow or by brad
Published on 2010-06-08T16:03:49Z Indexed on 2010/06/08 16:12 UTC
Read the original article Hit count: 272

Basically, I know how to create graph data structures and use Dijkstra's algorithm in programming languages where side effects are allowed. Typically, graph algorithms use a structure to mark certain nodes as 'visited', but this has side effects, which I'm trying to avoid.

I can think of one way to implement this in a functional language, but it basically requires passing around large amounts of state to different functions, and I'm wondering if there is a more space-efficient solution.

© Stack Overflow or respective owner

Related posts about functional-programming

Related posts about computer-science