Learn practical skills, build real-world projects, and advance your career

Graph Algorithms (BFS, DFS, Shortest Paths)

Graphs in the Real World

Railway network

alt

Flight routes

alt

Hyperlinks

alt

Graph Data Strucutre

alt

We will represent nodes with numbers and edges with tuples
n_nodes = 5
edges = [(0, 1), (0, 4), (4, 3), (3, 2), (2, 1), (1, 4), (1, 3)]
n_nodes, len(edges)
(5, 7)