

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Prof. Balamohan Pawar delivered this lecture at Allahabad University for Aeronautical Engineering and Computer Programming course. Its main points are: Graph, Markov, Analogous, Weight, Ada, Path, Shortest, Matrix, List, Link, Degree
Typology: Slides
1 / 3
This page cannot be seen from the preview
Don't miss anything!


(8 respondents)
Could the graphs be analogous to Markov chains and then would the weights be analogous to the transitions probabilities? The Markov chain can be represented as an infinite graph, with probabilities on the transitions instead of weights.
Could the shortest path problem also be approached with Markov chains? Maybe for systems with more uncertain weights? Or for systems where future weights are unknowns but estimates exist? Yes you can.
Can you find the shortest path (or least costly) using the adjacent matrix? Yes, there exists many different kind of algorithms to solve the shortest path problem in graphs. It is common that the algorithms take an NxN adjacency matrix as input and calculates an NxN matrix S, where Si,j is the length of the shortest path from vi to vj, or a special value, e.g., ‘∞’ if there is not path.
What is an example of a graph with negative weights? An interesting question, there are some paths that are undesirable but still have to be considered (say for instance in the case of a traffic jam), in that case, the weight assigned to the edge is negative (the goal in this case would be maximize the cost of traversing the graph).
The Ada language does not define a representation for infinity. That is left upto the implementation. You can define your own value for infinity. In the case of Dijkstra’s shortest path algorithm that we saw in class today, you can use a –ve value to represent infinity (because the algorithm only works for positive weights and tries to minimize the total weight).
A solution to the problem is shown in the lecture slides.
Dijkstra’s algorithm solves the problem of finding the shortest path from one node in the graph (the source) to a destination node in the graph. The algorithm actually finds the shortest path from the source node to all the other nodes in the graph at the same time.
Dijkstra’s algorithm keeps two sets of vertices S the set of vertices whose shortest paths from the source have already been determined Q The remaining vertices
The other data structures needed are d array or best estimates of shortest path to each vertex prev array of predecessors for each vertex (a predecessor list is a structure for storing a path through a graph)
The algorithm is shown in the lecture slides. The relaxation process is used to update the costs of all the vertices, v, connected to a vertex, u, if we could improve the best estimate of the shortest path to v by including (u, v) in the path to v.
each loop is counted twice.