Graph Data Structures: DFS, Connectivity & Recursive Algorithms

Added:

Graph Basics
Graph Storage
Query Types
Recursive Search
Search Issues
Visited Tracking
DFS Uncovered

Graph Basics

0:00
Playing Section
  • 1

    Defines a graph as vertices and edges, including directed and undirected types.

  • 2

    Explains weighted graphs where weights can be on nodes, edges, or both.

Fundamental understanding of recursion, including recursive call stacks and base cases.
Basic data structures, specifically arrays, linked lists, and objects/classes.
Conceptual familiarity with graphs, including definitions of vertices (nodes) and edges.
Basic knowledge of Big O notation to evaluate algorithmic time and space complexity.
Breadth-First Search (BFS) and queue-based level-order traversal of graphs.
Cycle detection in directed and undirected graphs, along with Topological Sorting.
Single-source shortest path algorithms on weighted graphs, such as Dijkstra's Algorithm.
Advanced connectivity concepts, such as finding Strongly Connected Components (SCCs) using Kosaraju's or Tarjan's algorithms.
33.8K views77likes43:57@iitOriginal Release: 2010-06-29

Graphs are data structures consisting of vertices (nodes) and edges, which can be directed or undirected, and may have weights on vertices, edges, or both. Three primary representations exist: adjacency matrix (array-based, efficient for dense graphs and edge queries), adjacency list (pointer-based, efficient for sparse graphs), and direct representation (linked structure). For path-based queries determining connectivity between two vertices, a recursive depth-first search algorithm can be designed using decomposition and recomposition techniques. However, this basic recursive approach can enter infinite loops when revisiting nodes in undirected graphs. To resolve this, dynamic programming with a visited array prevents revisiting nodes, ensuring the algorithm terminates correctly while maintaining the same recursive structure.