Re: Trouble implementing Dijkstra algorithm in Clojure

2010-02-02 Thread e
folks may be interested in this thing I was working on a while back for Dijkstra and Branch and Bound problems: http://code.google.com/p/jc-pheap/. ... I know this was a while ago :) On Tue, Dec 8, 2009 at 11:26 PM, David Brown wrote: > On Tue, Dec 08, 2009 at 03:22:47PM -0800, ataggart wrote:

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread David Brown
On Tue, Dec 08, 2009 at 03:22:47PM -0800, ataggart wrote: >I would be very surprised if getting the first element from a sorted- >set wasn't ~O(1). As has been mentioned, it probably isn't if the set is a tree. But, also, usually, in addition to getting the first element, we also are going to wa

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread ataggart
age -- > From: ataggart > Date: Tue, Dec 8, 2009 at 6:22 PM > Subject: Re: Trouble implementing Dijkstra algorithm in Clojure > To: Clojure > > On Dec 8, 11:38 am, Mark Tomko wrote: > > A priority queue implemented over a heap would be more efficient than > &g

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread ajay gopalakrishnan
implementing Dijkstra algorithm in Clojure To: Clojure On Dec 8, 11:38 am, Mark Tomko wrote: > A priority queue implemented over a heap would be more efficient than > a sorted set, in general. With a heap, you have constant time access > to the smallest (WLOG) element in the heap at

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread ataggart
On Dec 8, 11:38 am, Mark Tomko wrote: > A priority queue implemented over a heap would be more efficient than > a sorted set, in general.  With a heap, you have constant time access > to the smallest (WLOG) element in the heap at all times.  Removing it > costs a fixed O(lg n).  A sorted set (es

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread Mark Tomko
A priority queue implemented over a heap would be more efficient than a sorted set, in general. With a heap, you have constant time access to the smallest (WLOG) element in the heap at all times. Removing it costs a fixed O(lg n). A sorted set (especially one that's being modified) isn't necessa

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-07 Thread harrison clarke
you can use recur. it calls the fn/loop it's contained in with new args. (so, with the updated array and queue) On Dec 7, 8:19 pm, ajay wrote: > Hi all, > > I am new to FP in general and I am trying to pick up Clojure. I am > having trouble thinking in FP terms. > > I am trying to implement the D

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-07 Thread ataggart
On Dec 7, 4:19 pm, ajay wrote: > Hi all, > > I am new to FP in general and I am trying to pick up Clojure. I am > having trouble thinking in FP terms. > > I am trying to implement the Dijkstra algorithm for shortest paths in > Graph in Clojure. If this succeeds, I will implement all the advanced

Trouble implementing Dijkstra algorithm in Clojure

2009-12-07 Thread ajay
Hi all, I am new to FP in general and I am trying to pick up Clojure. I am having trouble thinking in FP terms. I am trying to implement the Dijkstra algorithm for shortest paths in Graph in Clojure. If this succeeds, I will implement all the advanced graph algos I am learning in this course in C