Skip to content

Visualizations for search algorithms #1155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tirthasheshpatel opened this issue Jan 14, 2020 · 5 comments
Open

Visualizations for search algorithms #1155

tirthasheshpatel opened this issue Jan 14, 2020 · 5 comments

Comments

@tirthasheshpatel
Copy link
Contributor

tirthasheshpatel commented Jan 14, 2020

I browsed through the search algorithms notebook and I think that adding the visualization of how the search algorithm expands and finds the path would be useful and interesting. Kind of what @redblobgames did in his article (and has probably been done in aima-javascript).

I made this for BFS using ipythonblocks:
vis

@antmarakis
Copy link
Collaborator

This is very interesting! I am not sure if I can add it myself though, since it is quite a substantial change. Is the code for it long? Do we need to import more libraries to run this?

@redblobgames
Copy link

On the aima-javascript side we did this page about search algorithms. We had to decide who the audience is:

  1. People who are making visualizations using a particular language? → we should show code for making the visualizations
  2. People who are implementing the algorithm using a particular language? → we should show code for the algorithm
  3. People who are learning the algorithm before using (or implementing it)? → we should show the concepts needed to understand the algorithm

Audience 1 is fairly small, so we didn't try to address it. Right now aima-python is audience 2 and aima-javascript is audience 3. That means the idea would be that if you are a python programmer you can understand the concepts by looking at the book and also aima-javascript's pages, then understand the code by looking at aima-python's sample code. But it might be nicer to have everything on one page instead of switching back and forth.

For my own pages I usually have a separate learn the concepts page (visualizations implemented in javascript) and learn how to implement it page (notebook style, with python and c++). This is mostly because I did not want to reimplement the visualizations in many different languages.

@tirthasheshpatel
Copy link
Contributor Author

@antmarakis We don't need to add any dependencies on top of what we have. Actually, ipythonblocks becomes too slow with medium-sized grids. So, I think we can have to do this using pure matplotlib (should not be a problem). The code should not be too long. We have to add kind of online version of all the search algorithms. I will work on it and submit a patch as soon as possible.

OTOH, @redblobgames said is also true. We have a lot of people who just come here to see the implementation of algorithms. But nevertheless, we can do this as a fun assignment with lower priority and focus primarily on improving implementations of existing algorithms.

@tirthasheshpatel
Copy link
Contributor Author

I got this using matplotlib and it supports all the search algorithms. I think this is much better than ipythonblocks in terms of speed.

The problem is that I can't get the matplotlib animations running in the notebooks so instead we have to just embed matplotlib plots in tkinter and add this to gui folder.

@tirthasheshpatel
Copy link
Contributor Author

After a little research, I was finally able to make the animations for the notebooks!

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 a pull request may close this issue.

3 participants