Skip to content

Dijkstra's wastes memory and time queuing nodes already in the queue#11

Open
damium wants to merge 3 commits intonanodeath:masterfrom
damium:master
Open

Dijkstra's wastes memory and time queuing nodes already in the queue#11
damium wants to merge 3 commits intonanodeath:masterfrom
damium:master

Conversation

@damium
Copy link

@damium damium commented Mar 4, 2012

It also causes problems when using a function to filter and gather info as nodes are in the visited list more than once. If a node is already in the queue it should look to see which path is shorter and select it.

I'm not positive that this is the best place for the fix, possibly it would be cleaner to apply it to the queue itself.

@nanodeath
Copy link
Owner

@damium Sorry I suck, I first looked at this quite a while ago but forgot to respond.

Can you explain why you added the Graph#replaceNode method? You're not actually using it.

Regarding the extra-nodes-trimming, I think that part looks good. I think the complexity adding that sort of functionality to the queue would be inappropriate, given it's supposed to be just a plain priority queue.

@damium
Copy link
Author

damium commented Apr 11, 2012

I'm using the replaceNode method in another project so it was mainly for my use there and was added after I opened the pull request for the original fix. I'm not sure if it would be generally useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants