I wanted to implement Dijkstra's algorithm to find the shortest distance between two nodes.
-
1Even wikipedia lists the algorithm... https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm – xen-0 Aug 01 '13 at 09:28
2 Answers
I have integrated this Java implement to my android project: https://github.com/stewbob/dijkstra

- 481
- 3
- 9
This question has asked already if your question is different then provide more information Google Maps algorithm
Otherwise You can do like this.
Several algorithms have so far been introduced to find out the shortest path in a network. Though none of the algorithms can be considered as the best in all the situations, Dijkstra's algorithm is the fastest known single-source shortest-path algorithm for arbitrary directed graphs with unbounded nonnegative weights. This algorithm is often used in routing. This algorithm when implemented in android and supported by proper GUI can produce a simple yet powerful application which can be used by marketing executives, tourists or city newbies etc. In today’s world where we are falling short of fuel, knowing shortest path is useful. Public transport can also be modeled as a graph: every station is represented by a node and an edge exists if there is a line directly connecting two station. Here I have used a college premises for experimentation.
In another activity Google map is displayed and the current location of the device is also shown. All the nodes on the geographical area are numbered using canvas.drawText and the shortest path is drawn using canvas.drawPath. One of the class contains all the code to create and upgrade the SQLite database and the code to open and close the database and to insert and delete and retrieve and update the records. All the nodes visited so far by the marketing executive can be viewed on Google map and SMSed to his authority or anyone by adding contact from the phonebook. The application can connect with web server. In case the executive do not know the next place to be visited, he sends a request to the server to supply him with the necessary information. The web servers is made in asp.net. The database used there is Ms Access.
If this application is being used by marketing executives, then all of them are connected to their marketing company’s web server where they inquire about their next location to visit. SQLite stores the all the nodes visited so far. As per the developer’s guide “SQLite is a powerful and lightweight relational database engine available to all applications”.

- 1
- 1