Back to curriculum

Course section

Graphs & Applications

Model networks, routes, dependencies, and connectivity using traversal, shortest-path, MST, and disjoint-set algorithms.

10 topics
01

Graph Fundamentals

Graphs consist of vertices and edges and may be directed, undirected, weighted, cyclic, connected, or sparse.

Visual lab
02

Graph Representation

Adjacency lists use O(V+E) space and suit sparse graphs; matrices use O(V²) space and give O(1) edge tests.

ComplexityC++ implementation Visual lab
03

Breadth-First Search

BFS explores vertices by increasing unweighted distance using a queue and produces shortest paths in edge count.

ComplexityC++ implementation Worked trace Visual lab
04

Depth-First Search

DFS follows one path deeply before backtracking and supports cycle detection, ordering, components, and structural analysis.

ComplexityC++ implementation Worked trace Visual lab
05

Dijkstra’s Algorithm

Dijkstra finalises minimum distances from one source by repeatedly extracting the closest unsettled vertex.

ComplexityC++ implementation Worked trace
06

Floyd–Warshall

Floyd–Warshall computes all-pairs shortest paths by progressively allowing each vertex as an intermediate.

ComplexityC++ implementation Worked trace
07

Disjoint Set Union

DSU maintains a changing partition of elements and answers whether two elements belong to the same component.

ComplexityC++ implementation Worked trace
08

Prim’s MST

Prim grows one minimum spanning tree by repeatedly adding the cheapest edge crossing from the tree to an outside vertex.

ComplexityC++ implementation Worked trace
09

Kruskal’s MST

Kruskal considers edges from lightest to heaviest and uses DSU to add only edges that connect different components.

ComplexityC++ implementation Worked trace
10

Sustainable Graph Applications

Graph models support smart grids, recycling networks, transit planning, waste collection, and resilient infrastructure.