Lessons Learned here was that BFS provides the shortest path. If I run BFS on one vertex and have a path to the other, then that is the shortest path. If I do not have a path, I should run BFS on the other vertex also, and then go through the nodes that are reachable by both vertices. The ancestor and the shortest path is in the set of commonly reachable nodes. I kept track of these nodes by saving them in a Queue called modified nodes. This allowed my improve the performance of my BFS, which I was instructed to call DelluxBFS. This modified queue was very handy for saving the result of a BFS into a cache without having to go loop through all the vertices of the graph. I just went through the ones in the queue. I could also quickly reset the BFS without having to initialize another instance. I would just go through the vertices that were changed, and change them back to the original value. This was the strategy that was suggested by this assignment on Coursera, but the idea of saving it in a queue was mine. While I need to improve this code, it did pass the tests and I can move on to the next section. There are marked[], distTo[], edgeTo[], and onStack[] arrays as well as markedCache[], distToCache[], edgeToCache[]. The anscestor will be in both versions of the arrays cached adn the original and its distance to each node will be the least compared to other vertices in modified queue. I followed edgeTo[] to get to one vertex from ancestor and edgeToCach[] to get to the other vertext.
-
Notifications
You must be signed in to change notification settings - Fork 0
bitflame/WordNetRevisited
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published