weighted graph algorithms
play

Weighted Graph Algorithms Weighted shortest path problem Dijkstras - PowerPoint PPT Presentation

Weighted Graph Algorithms Weighted shortest path problem Dijkstras algorithm (single source, non negative edge weight) All pairs shortest path Warshalls algorithm Definition of a path Consider a directed graph


  1. Weighted Graph Algorithms • Weighted shortest path problem – Dijkstra’s algorithm (single ‐ source, non ‐ negative edge weight) • All pairs shortest path – Warshall’s algorithm

  2. Definition of a path • Consider a directed graph G=(V, E) with edge ‐ weight function w: E  R.  v 2: – Weight of edge v 1 w(v 1 ,v 2 )  v 2  …  v k • The weight of a path p=v 1 is defined to be w(p)= sum w(v i , v i+1 ), i=1..k ‐ 1

  3. Shortest path • A shortest path from u to v is a path of minimum weight from u to v – There might be multiple paths from u to v – The shortest path weight from u to v is defined as –

  4. Single source shortest path • Problem: from a given source vertex s, find the shortest path weights from s to all vertices in V. – If all edge weights w(u,v) are non ‐ negative, all shortest path weights must exist • Idea: greedy – Maintain a set S of vertices whose shortest path weights from s are known. – At each step, add to S the vertex v, whose distance estimate from s is minimal – Update the distance estimates of all vertices adjacent to v.

  5. Dijkstra’s algorithm

  6. Running time analysis

  7. Running time analysis

  8. • Unweighted shortest path problem • Dijkstra with negative weights

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend