shortest-path

Dijkstra’s shortest path algorithm

别说谁变了你拦得住时间么 提交于 2020-01-24 04:56:06
问题 The following is algorithm summary given to us by our professor. What is the parent of a node in a graph as referred to in step 3? I'm a little confused as I though that the nodes only had neighbors and doesn't have a parent? My second question is about step 3, "pick up the index’th record in stack." Since a stack only allows you to view the top, I'm not sure what it means by picking up the index'th record? Dijkstra’s shortest path: Step 0: if s == d, stop. Step 1: current node c= s, c.length

Updating Shortest path distances matrix if one edge weight is decreased

本小妞迷上赌 提交于 2020-01-23 08:17:05
问题 We are given a weighed graph G and its Shortest path distance's matrix delta. So that delta(i,j) denotes the weight of shortest path from i to j (i and j are two vertexes of the graph). delta is initially given containing the value of the shortest paths. Suddenly weight of edge E is decreased from W to W'. How to update delta(i,j) in O(n^2)? (n=number of vertexes of graph) The problem is NOT computing all-pair shortest paths again which has the best O(n^3) complexity. the problem is UPDATING

Check if the position if less then or greater then another position prolog

别等时光非礼了梦想. 提交于 2020-01-15 03:35:13
问题 I have revised this question to be more specific on what I'm looking for. I am trying to find if the position of (1,2) is greater than (1,1). Using the following code I get a specific element, being what , and return the position. For example if we want to find 1 in this maze, than we do the following: findMaze([Row|_],What,(0,C)):- findRow(Row,What,C). findMaze([_|Rows],What,R):- findMaze(Rows,What,TempR), R is TempR + 1. findRow([What|_],What,0). findRow([_|Tail],What,Where):- findRow(Tail

Faster way to calculate the number of shortest paths a vertex belongs to using Networkx

风流意气都作罢 提交于 2020-01-13 18:59:00
问题 I am considering that the Stress of a vertex i is the number of shortest paths between all pairs of vertices that i belongs to. I am trying to calculate it using Networkx, I've made in three ways so far. The readable , dirty , and dirtiest but none of them is fast. Actually, I would like it to be faster than the betweenness (source) present on Networkx. Is there a better way to calculate that? Thanks in advance for any suggestion, answer or comment. Following see what I did so far: Ps.: Here

Faster way to calculate the number of shortest paths a vertex belongs to using Networkx

偶尔善良 提交于 2020-01-13 18:58:06
问题 I am considering that the Stress of a vertex i is the number of shortest paths between all pairs of vertices that i belongs to. I am trying to calculate it using Networkx, I've made in three ways so far. The readable , dirty , and dirtiest but none of them is fast. Actually, I would like it to be faster than the betweenness (source) present on Networkx. Is there a better way to calculate that? Thanks in advance for any suggestion, answer or comment. Following see what I did so far: Ps.: Here

Are there any R Packages for Graphs (shortest path, etc.)?

◇◆丶佛笑我妖孽 提交于 2020-01-13 09:57:27
问题 I know that R is statistical pkg, but probably there is library to work with graphs and find shortest path btw 2 nodes. PS actually, I've found igraph and e1071, which one is better? Thank you 回答1: Sure, there's a Task View that gathers a fair number of the graph-related Packages. (The page linked to is a CRAN portal, which uses iframes, so i can't directly link to the Graph Task View. So from the page linked to here, click on Task Views near the top of the LHS column, then click on the Task

Dijkstra's (or other shortest path algorithm) where end node can be start node

时间秒杀一切 提交于 2020-01-07 07:11:13
问题 The traditional* implementation of Dijkstra's does not handle this case well. I think I've come up with some solutions that will work, but they are not particularly elegant**. Is this is a known problem with a standard solution? This is assuming the non-trivial solution i.e. a path like A->B->C->A rather than just A->A. * When I say traditional I mean marking each node as visited. ** Storing the number of times each node has been visited and basing the terminating conditions on whether the

Best way to implement shortest path algorithm with directed graph [closed]

强颜欢笑 提交于 2020-01-05 05:00:12
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Lets assume i have a weighted undirected graph with edges and wanted to find the shortest path as well as all possible paths that i could follow from the startpoint to the endpoint with distances, what would be the best way to implement this? Breadth depth search and k paths

Optimizing a Grid consisting of cells in WPF for Shortest Path

拜拜、爱过 提交于 2020-01-05 03:24:20
问题 I'm currently trying to make a grid consisting of Cell objects in WPF. I need to bind the cells to objects, which needs to be in a 2D array. - And i need it to be big, scalable and to change color of cells and store data in the objects! I have an implementation made, but it seems to be very slow to draw the grid! (100x100 grid takes >10 secs!) Here is a picture of what i have already made: I'm using databinding in XAML in an ItemsControl. Here is my XAML: <ItemsControl x:Name="GridArea"

Shortest route between multiple points in mapkit for iphone app

时光毁灭记忆、已成空白 提交于 2020-01-04 11:39:06
问题 In my application suppose user selects 4 cities to vist with S as starting city and D as destination city then is there any API or webservice for this . Here the users visits the city one time only and the output should be the shortest path between A and D by covering all the cities. If somebody has any other idea it is also welcomed. Thanks and Regards Mrugen 回答1: Mapquest has recently really taken the lead in terms of navigation and geocoding APIs. FAR better than Google's offering, IMO.