I have an SVG object with a floor map which is made from a creator user and I want to find dynamically the shortest path between 2 points on this object. Dijkstra algorithm is the better solution for finding shortest path into a graph but this solution required the knowledge of all nodes of graph. I think that there are two solutions to make the shortest path.
Solution No1: http://postimg.org/image/sok88bsgd/
When user creates the floor map should make simultaneously the graph of this map. In other words user should make all of possible path in this map. The advantage of this solution is that the calculation of the shortest path is very fast but the disadvantage is that the creator should make all the possible path with his hand.
Solution No2: http://postimg.org/image/4c2bd7smr/
The system calculate all of the SVG object and calculate the shortest path. The huge disadvantage of this solution is that the calculation is very very slow. Do you have a better solution? Thank you for your response.