Floyd Warshall Problem

Duration: 7 min

This video lesson is available to enrolled students.

Return to /learn/UP-LT-GRADE-ASSISTANT-TEACHER-2025/cs-03-data-structures-and-algorithm/dynamic-programming/floyd-subset-sum/asset-floyd-warshall-problem after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. About Course: About the Course
  2. CS | 01 | Digital Logic and Circuits and Discrete Mathematical Structures: Digital Systems & Boolean Basics, Number System, Number Representation, Logic Gates & Hardware, Boolean Expression, Boolean Minimization, Combinational Circuit, Sequential Circuits, Set Theory, Relations, Functions, Graph Theory, Group Theory, Propositional and Predicate Logic, Permutation and Combination
  3. CS | 02 | Computer Organization and Architecture: Basics of COA, Cache Memory Organization, Input Output Organisation, Pipelining, Instr Formats & Modes, Control Unit Design, Multiprocessors
  4. CS | 03 | Data Structures and Algorithm: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing, Algorithm Analysis, Time Complexity Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos, Complexity Theory, Advanced Algorithms
  5. CS | 04 | Problem Solving through C Programming: C Fundamentals, Control Flow, Functions, Arrays & Pointers, Storage Classes, Structures & Enums, DMA, Macros, Scoping & File Handling
  6. CS | 05 | Object Oriented Techniques: Object Oriented Technology, Java
  7. CS | 06 | Operating System: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Threads & Process Creation, Deadlock, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Unix OS
  8. CS | 07 | Database Management Systems: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, Relational Algebra, SQL, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, Database Security & Authorization, Query Processing & Optimization, File Organization & Indexing
  9. CS | 08 | Computer Networks: Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics
  10. CS | 09 | Software Engineering: Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management
  11. CS | 10 | Internet Technology, Web Design and Web Technology: Internet Fundamentals, Web Design & Development, Protocols & Services, Web Publishing & Hosting, Server Side & Security, Emerging Technologies, JavaScript-Basics, HTML Basics
  12. CS | 11 | System Analysis And Design: Fundamentals of Systems and Information Systems, SDLC and Development Approaches, Software Documentation and Software Requirements Specification (SRS), SDD and Quality Assurance, Security, Risk Management & Maintenance
  13. CS | 12 | Information Security and Cyber Laws: Cyber Threats and Malware Attacks, Role of Internet and Web Services, Security in Mobile and Wireless Computing, Electronic Data Interchange and E-Commerce, Physical Security and Cryptography Basics, Intrusion Detection Systems (IDS), Cyber Safety and Security
  14. CS | 13 | Computer Graphics: Basics of Computer Graphics, 2-D Geometrical Transforms and Viewing, 3-D Object Representation, Geometric Transformations and Viewing
  15. GS Paper | 01 | Indian and World Geography: Geography
  16. GS Paper | 02 | History: History
  17. GS Paper | 03 | Indian Economy & Social Development: Indian Economy
  18. GS Paper | 04 | General Science: Biology, Chemistry, Physics
  19. GS Paper | 05 | Elementary Maths: Number System, Divisibility Rules, HCF LCM, Percentage, Profit and Loss, Simple Interest and Compound Interest, Ratio and Proportion (Ratios), Average, Time and Work, Speed Time and Distance, Algebra, Mensuration and Geometry, Data Interpretation, Arithmetic, Statistics, Probability, Sequence and Series (Series), Mixture and Alligation, Calculus, Trigonometry, Vectors
  20. GS Paper | 06 | Indian Polity and Governance: Polity
  21. GS Paper | 07 | Current Events: GK- Current Affairs
  22. UPLT Live Classes Notes: UPLT Live Classes
  23. UPLT Full Mock Tests Tier 1:
  24. UPLT Full Mock Tests Tier 2:
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

The video is an educational tutorial demonstrating the Floyd-Warshall algorithm to solve the all-pair shortest path problem in a directed weighted graph. The instructor uses a specific example with three nodes (a, b, c) to walk through the iterative process of updating distance and predecessor matrices. The lecture covers the initialization phase, followed by three distinct iterations where each node is used as an intermediate vertex to relax edge weights. Key visual elements include the hand-drawn graph, the initial matrices D0 and Pi0, and the step-by-step updates to Da, Db, and Dc. The instructor explicitly writes values into the matrices on the slide, highlighting changes in path costs and predecessors. The text "running time of O(n^3)" is visible on the right side of the screen throughout the process.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The instructor introduces the problem statement: "Consider a Directed weighted Graph and find all pair shortest path?" displayed at the top of the slide. He presents a hand-drawn graph with nodes a, b, and c, and edges labeled with weights such as 6, 4, 2, 3, and 11. He begins constructing the initial distance matrix D0 and predecessor matrix Pi0. He fills the diagonal elements with 0. He populates D0 with direct edge weights: D0_ab=4, D0_ac=11, D0_ba=6, D0_bc=2, and D0_ca=3. For non-existent edges like c to b, he writes infinity. He also fills Pi0 with the source node indices for existing edges. The matrix structure is clearly labeled with row and column headers 'a', 'b', 'c'.

  2. 2:00 – 5:00 02:00-05:00

    The lecture moves to the first iteration, Da, where node 'a' is the intermediate. The instructor explains the update rule Dk_ij = min(Dk-1_ij, Dk-1_ik + Dk-1_kj). He calculates that the path from c to b can be improved via a. The cost becomes D0_ca + D0_ab = 3 + 4 = 7, which is less than infinity. So, Da_cb is updated to 7, and Pi^a_cb becomes 'a'. Other entries like Da_ba remain 6. Next, he proceeds to iteration Db. He checks paths through 'b'. He finds that the path from a to c can be shortened. The cost via b is D0_ab + D0_bc = 4 + 2 = 6, which is less than the original 11. Thus, Db_ac is updated to 6, and Pi^b_ac is set to 'b'. He also notes that Db_ca remains 3.

  3. 5:00 – 6:41 05:00-06:41

    The final iteration, Dc, uses node 'c' as the intermediate. The instructor updates the matrices based on paths through 'c'. He identifies that the path from b to a can be shortened. The cost via c is Db_bc + Db_ca = 2 + 3 = 5, which is less than the previous distance of 6. Therefore, Dc_ba is updated to 5, and Pi^c_ba is set to 'c'. He verifies other entries remain optimal. The video concludes by displaying the final matrices Dc and Pi^c, which contain the shortest distances and predecessors for all pairs. The final distance matrix shows Dc_ab=4, Dc_ac=6, Dc_bc=2, Dc_ca=3, and Dc_cb=7.

The video provides a clear, step-by-step walkthrough of the Floyd-Warshall algorithm. It effectively bridges the gap between the theoretical relaxation formula and its practical application on a small graph. By visually updating the matrices row by row and iteration by iteration, the instructor clarifies how intermediate nodes progressively improve path estimates. The final matrices represent the complete solution to the all-pair shortest path problem for the given graph.

Loading lesson…