shortest-path

What is a minimal path in a graph?

In graph theory, what is the distinction between minimal distance (which Dijkstra's algorithm finds), and minimal path (which I'm not sure what it is)? ...

Generating a picture/graphic of a graph

In working on a shortest path algorithm across a network I would like to generate a picture of the network. I'd like to represent nodes (circles), links (lines), cost to traverse the link (number in the middle of the link line), and capacity of the link (number on the link line next to the node it represents) in the picture. Is there any...

Using Boost's graph breadth_first_search() to find a path in an unweighted, undirected graph

I'm using an adjacency_list graph, with undirected and unweighted edges. I need to find a shortest path between vertex u and vertex v. Should I use breadth_first_search() starting from u? When reaching v, how do I obtain the path, and how do I stop the search? thanks! ...

Linear Array with nodes randomly linked to other nodes in array, shortest path.

INFO: I have an Array of 100 nodes, [ 0 .. 99 ]. Each node can have an arbitrary number of linked nodes: eg1, 0 links to 5, 10, 15, 20. eg2, 1 links to 30, 40, 50. eg3, etc.. All 100 nodes have at least one linked node, nodes do not know who links to them. QUESTION: How can I find the shortest link-path if provided with START and END...

QuickGraph Dijkstra example.

I have an AdjacencyGraph<string, Edge<string>> which I would like to run AlgorithmExtensions.ShortestPathsDijkstra on, but the QuickGraph documentation isn't the best. Does anyone have an example I can follow? Everything I found on on Google used an observer, which the AlgorithmExtension doesn't require. ...

How do I find the shortest path that covers all nodes in a directed cyclic graph?

I need an example of the shortest path of a directed cyclic graph from one node (it should reach to all nodes of the graph from a node that will be the input). Please if there is an example, I need it in C++, or the algorithm. Thanks very much......... ...

Suggestions for KSPA on undirected graph

Hello Group, There is a custom implementation of KSPA which needs to be re-written. The current implementation uses a modified Dijkstra's algorithm whose pseudocode is roughly explained below. It is commonly known as KSPA using edge-deletion strategy i think so. (i am a novice in graph-theory). Step:-1. Calculate the shortest path bet...

Dijkstra algorithm for iPhone

Hello all! It is possible to easily use the GPS functionality in the iPhone since sdk 3.0, but it is explicitly forbidden to use Google's Maps. This has two implications, I think: You will have to provide maps yourself You will have to calculate the shortest routes yourself. I know that calculating the shortest route has puzzled ma...

A* heuristic: Shortest path passing once in multiple points

I'm trying to come up with a good and fast heuristic for a clear-map pacman game. My heuristic is trying to calculate the smallest distance possible that the pacman needs to travel to go to every points with food on the map. My current algorithm is basicly Prim's MST which gets me a O(n logn) running time, but doen't account for situati...

Performance of Bellman–Ford shortest path algorithm

I implemented the solution of Bellman - Ford algorithm with a queue and I compared its performance with the Dijkstra algorithm. They were pretty close and that was a surprise for me because the complexity of Bellman - Ford is O(NM). I know that the complexity is for the worst case, but still the result was surprising. I searched for some...

What algorithm can I use to find the shortest path between specified node types in a graph?

This is the problem: I have n points (p1, p2, p3, .. pn), each of them can connect to any other with a determined cost x. Each point belongs to one of a set of point-types (for example "A" "B" "C" "D"...). The input of the method is the path I want to follow, for example "A-B-C-A-D-B". The output is the shortest path connecting the p...

Pen Plotter Problem(find shortest path for pen to move to draw a diagram,java)

Before the advent of inkjet and laser printers, straight line drawings used to be plotted by coloured pens on large sheets of paper: the pens moved very slowly so this was a time-consuming process. Since time is money, it was important to draw figures in an optimal way, using minimum time. you will implement an A* search procedure for t...

Floyd-Warshall visualisation suggestions?

I'm after some ideas for demonstrating the usefulness of Floyd-Warshall visually. So far all I can think of is generating a random graph, allowing the user to select a start/finish and highlight the shortest path. What are some more fun yet simple demonstrations of the usefulness of path-finding? ...

Shortest Path For A Dag

I have a graph with an s and t vertex that I need to find the shortest path between. The graph has a lot of special properties that I would like to capitalize on: *The graph is a DAG (directed acyclic graph). *I can create a topological sort in O(V) time, faster than the traditional O(V + E). *Within the topological sort, s is the first ...

Shortest path to transform one word into another

For a Data Structures project, I must find the shortest path between two words (like "cat" and "dog), changing only one letter at a time. We are given a Scrabble word list to use in finding our path. For example: cat -> bat -> bet -> bot -> bog -> dog I've solved the problem using a breadth first search, but am seeking something bette...

Shortest path (fewest nodes) for unweighted graph

I'm trying build a method which returns the shortest path from one node to another in an unweighted graph. I considered the use of Dijkstra's but this seems a bit overkill since I only want one pair. Instead I have implemented a breadth-first search, but the trouble is that my returning list contains some of the nodes that I don't want...

How can I find the shortest path in a graph, with adding the least number of new nodes?

I need to find the shortest path in a graph with the least number of added nodes. The start and end nodes are not important. If there is no path in a graph just between specified n-nodes, I can add some nodes to complete the shortest tree but I want to add as few new nodes as possible. What algorithm can I use to solve this problem? ...

Find the shortest Path between two nodes (vertices)

I have a list of interconnected edges (E), how to find the shortest path connecting from one vertex to another? I am thinking about using lowest common ancestors, but the edges don't have a clearly defined root, so I don't think the solution works. Shortest path is defined by the minimum number of vertexes treversed. Note: There coul...

Longest circle in graphs

Hi folks, I want to solve the following problem: I have a DAG which contains cities and jobs between them that needs to be done. The jobs are for trucks which can load a definied limit. The more the truck is loaded the better is the tour. Some jobs are for loading something in and some are for loading defined things out. You can always...

Simple reduction (NP completeness)

hey guys I'm looking for a means to prove that the bicriteria shortest path problem is np complete. That is, given a graph with lengths and weights, I need to know if a there exists a path in the graph from s to t with total length <= L and weight <= W. I know that i must take an NP complete problem and reduce it to this one. We have at...