This app allows you to search on non-oriented graph and displays all possible N cities that are reachable from city X
- Download the code from the repository
- Open index.html file
To add city enter its name and click "Add city". You will see it in the Cities list! Add minimum two cities.
Select two different cities in the Add connections and click Add.
Notice: there is no need to add two connections between two cities. One connection from City 1 => City 2 will work on both sides because graph is not oriented
Once you have completed the previous steps select the city you want to be a starting point and click Show
The graph is stored using matrix. In order to effectively work with matrixes in JavaScript an external math library is needed.
Algorythm used here is called DFS. It works on adjacency lists, so before starting the algorythm I convert matrix to an adjacency list and then start it