Skip to main content
grasp.study
About
Explore
Pricing
Log in
Try it for free
Back to course
👋
Welcome to a Grasp lesson
Create a free account
to keep studying and create your own study path.
Graph Theory for Competitive Programming
·
Module 4
Topological Sort and DP on DAGs
1
Introduction to DAGs and Topological Ordering
Define a Directed Acyclic Graph (DAG) and a topological ordering of its vertices.
2
Topological Ordering and DAGs
Prove that a directed graph has a topological ordering if and only if it is a DAG.
3
Kahn's Algorithm for Topological Sort
Implement topological sort using Kahn's algorithm (a BFS-based approach with in-degree tracking).
4
Topological Sort: DFS Approach
Implement topological sort using a DFS-based approach.
5
DP on DAGs: Counting Paths
Apply DP on a topologically sorted DAG to count the number of distinct paths between two vertices.
6
Shortest Paths in Weighted DAGs: DP on Topological Order
Compute the shortest paths from a source vertex in a weighted DAG using DP on the topological order.
7
Longest Paths in DAGs using Shortest Path Algorithms
Compute the longest paths from a source vertex in a weighted DAG by negating edge weights and finding shortest paths.
Next module isn't ready yet,
Back to course
Previous module
Foundations of Dynamic Programming
Next module