shortest-path

How can i optimize this dijkstra structure code?

This is the dijkstra structure i am using :(however the MAXV(which is maximum number of vertices is maximum at 500 and every time i try to change it to something more than this it generates and error when running ) -I want to use this way to represent a graph with 10000 vertices, does anyone know how to optimize it ? #include<iostream>...

I can't make this dijkstra code compille can anyone help me? (THE ALGORITHM DESIGN MANUAL)

This Code is a code i built from the algorithm design manual book but i can't make it compile cause i've got little experience with pointers i think that's the main reason i think i can't compile it : And if someone can change a little bit in the djikstra to make it through heap with the current configuration. PLEASE HELP. #include<ios...

Google Map Get Direction Search Algorithm

Hi! I learned that Google Map has a Get Direction feature that let users find the shortest path from one point to another. What search algorithm did Google used for this search? Is this algorithm can be implemented in the Android platform, knowing that it has low memory and it's running in Java(tend to be slow)? Thanks in advance! ...

What is meant by diameter of a network?

The diagram shown on this link of the "A graph with 6 vertices and 7 edges where the vertex no 6 on the far-left is a leaf vertex or a pendant vertex." has DIAMETER 4? right or wrong? Definitions are The diameter of a graph is the maximum eccentricity of any vertex in the graph. That is, it is the greatest distance between any...

develop distance matrix using coordinates

hey, I have been given a problem, I basically have been given a piece of grid paper of arbitary size and have to develop a distance matrix using only the coordinates for each of the grid points on the page. I'm thinking the best approach would be something like the Floyd-Warshall or Djikstra algorithms for shortest path pair, but don'...

Interview: Find shortest path to few elements

There is a museum organized as NxN room. Some rooms are locked and inaccessible. Other rooms are open and some rooms have guards. Guards can only move north, south, east and west, only through open rooms and only within the museum. For each room, find the shortest distance to a guard. What is the time complexity of your algorithm? ...

shortest path through a maze

I am working on a project that i must traverse a maze using the left-hand rule and based upon the intersections the program comes upon i need to create a node to connect to a graph that I will then determine the shortest path. The goal is for the program to run through the maze then close out the program and read from a file that contain...

shortest paths not path in graph

Hi I was wondering if there is an algorithm which would find shortest paths in graph. Let's say that I have a graph where there are couples of path from one vertex to another. Two or more of these paths have the same cost. How can I mark,find etc all shortest paths between these vertices ? As far as I konw Djikstra or Bellman-Ford algori...

How does route finding software work?

I'm asking at a pretty high, language independent, level. How does route finding (as found in Google Maps 'Get directions' or a GPS) work? I can't believe it tries every conceivable route and chooses the shortest/fastest etc. There must be some logical way of finding the best route given a start and end point. Any sort of explanation w...

Bidirectional A* (A-star) Search

I'm implementing a bidirectional A* search (bidirectional as in the search is performed from both the origin and destination simultaneously, and when these two searches meet, I'll have my shortest path - at least with a bit of extra logic thrown in). Does anyone have any experience with taking a unidirectional A* and bidirectionalising(...

A* implementation always returns same value

Hi all, I seem to be either losing my mind or misimplementing the A* algorithm: Below is my code, it seems that no matter what values I enter it will always return 360. Am I missing some critical piece of information here? Also before anyone asks yes this is related to a machine learning assignment I received. public class A_...

Does dijkstras algorithm relax the edges of the shortest path in order?

In "Introduction to algorithms, 3rd edition" exercise 24.3-5 wants an example that this is wrong (not always true). Is that possible? In my mind this is impossible because every edge is relaxed at a time when the path to the current vertice is already decided. Word for word: Professor N. claims to have a proof of correctness of Dijk...

function to traverse on a 5*5 grid in lowest no. of turns in C

I am actually doing coding for a grid solver in C. Now i have defined a function called void get_target(void){} which has to set the target_x and target_y coordinates to a value on 5*5 coordinate system. I want to traverse the grid in least possible time covering all points with minimum number of turns( only 90deg turns, 180 deg turns...

Shortest route with no set destination in Google Maps V3?

So I'm just learning javascript to mess with the Google Maps API. I was wondering if anyone had an elegant solution to this problem I'm running into. A Google Maps route request must contain three things (origin, destination, and travelMode). My travelMode will always be DRIVING. The origin will always be wherever the user is located. ...