Floyd Warshall Problem
Duration: 7 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Discrete Mathematics: Set Theory, Relations, Functions, Graph Theory, Group Theory, Propositional and Predicate Logic
- DataBase Management System/DBMS: Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, SQL, Relational Calculus, Transaction Management, Concurrency Control
- Digital Electronics: Digital Systems & Boolean Basics, Logic Gates & Hardware, Boolean Expression, Boolean Minimization, Combinational Circuit, Sequential Circuits, Number System, Number Representation
- Computer Architecture: Floating Point Rep, Cache Memory Organization, Input Output Organisation, Pipelining, Instr Formats & Modes, Control Unit Design
- Operating System: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Threads & Process Creation, Deadlock, Memory Management, Virtual Memory, Disc Scheduling, File Management
- C Language: C Fundamentals, Control Flow, Functions, Arrays & Pointers, Storage Classes, Structures & Enums, DMA, Macros, Scoping & File Handling
- Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- Algorithms: Algorithm Analysis, Time Complexity Analysis, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Minimum Spanning Trees, Shortest Path Algos
- Computer Networks: Introduction to CN, 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
- Theory Of Computation/Automata Theory: Introduction to TOC, Deterministic FA (DFA), Non-Deterministic FA, Regular Expressions, Grammar, Regular Language Properties, Moore & Mealy Machines, Pushdown Automata & CFG, Turing Machines, Complexity Theory
- Compiler Design: Intro to Compilers, Lexical Analysis, Grammar & CFG, Syntax Analysis: Top-Down, Syntax Analysis: Bottom-Up, Semantic Analysis & SDT, Intermediate Code Gen, Code Optimization, Run Time Environment
- Engineering Mathematics: Permutation and Combination, Linear Algebra, Calculus, Probability, Statistics
- General Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Percentage, Mensuration and Geometry, Mental Ability, Arithmetic, Profit and Loss, Powers and Exponents (Surds and Indices), Average, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Syllogisms, Venn Diagram, Seating Arrangements, Blood Relations, Directions (Direction Test), Analogy, Algebra, Time and Work, Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Cubes & Dices, Ranking, Order and Sequence, Mixture and Alligation, Age Problems, Clock, Selection Decision Table (Decision Making), Data Arrangement
- English (Verbal Aptitude): Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Pronoun, Preposition, Direct and Indirect Speech, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Completion (Fill in the blanks), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Sentence Correction (Error Correction), Verbal Analogy (Word Based Analogy), Conjunction, Interjection, Verb, Articles, Adverb, Modals, Sentence Construction
- Live Classes Recordings(Earlier Batch): GATE 2026 Live Class
- Full Mock Test:
- Previous Year Papers:
- GATE 2026 Counselling: Counselling and Guidance Sessions
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
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: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.
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.