🌍 Data Structures & Algorithms · subject
Data Structures & Algorithms Graphs & Advanced Structures Syllabus
Every chapter and topic of Graphs & Advanced Structures examined in Data Structures & Algorithms — 6 chapters, 17 topics, plus 56 flashcards written against it.
Graphs & Advanced Structures syllabus — full chapter and topic list
Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Graphs & Advanced Structures in Data Structures & Algorithms, not a summary of it.
-
Graph Representation
2 topics- Graph Types
- Representations
-
Graph Traversal
3 topics- Breadth-First Search
- Depth-First Search
- Topological Sorting
-
Shortest Path Algorithms
4 topics- Dijkstra's Algorithm
- Bellman-Ford Algorithm
- Floyd-Warshall Algorithm
- A* Search
-
Minimum Spanning Trees
2 topics- Kruskal's Algorithm
- Prim's Algorithm
-
Disjoint Set Union
3 topics- Union-Find Structure
- Optimizations
- Applications
-
Advanced Graph Topics
3 topics- Strongly Connected Components
- Articulation Points and Bridges
- Network Flow Basics
Graphs & Advanced Structures flashcards for Data Structures & Algorithms
24 of 56 cards from the Graphs & Advanced Structures deck — real questions with worked answers.
What distinguishes a directed graph from an undirected graph?
In a directed graph, each edge $(u,v)$ has an orientation from $u$ to $v$, so adjacency is not symmetric. In an undirected graph, an edge $\{u,v\}$ has no direction and connects both endpoints equally.
Define a weighted graph and give the standard notation for an edge weight.
A weighted graph assigns a numeric value to each edge, written $w(u,v)$ (or $w(e)$). Weights model costs, distances, or capacities.
What is the maximum number of edges in a simple undirected graph with $n$ vertices, and in a simple directed graph?
Undirected: $\binom{n}{2} = \frac{n(n-1)}{2}$. Directed (no self-loops): $n(n-1)$.
Define a complete graph $K_n$ and state its edge count.
A complete graph $K_n$ has an edge between every pair of distinct vertices. It has $\frac{n(n-1)}{2}$ edges.
What is a bipartite graph, and what property characterizes it in terms of cycles?
A bipartite graph's vertices split into two disjoint sets with all edges going between the sets. A graph is bipartite if and only if it contains no odd-length cycle.
Define a tree in graph terms and give its edge count for $n$ vertices.
A tree is a connected, acyclic undirected graph. A tree on $n$ vertices has exactly $n-1$ edges.
What is a DAG?
A Directed Acyclic Graph: a directed graph with no directed cycles. DAGs admit a topological ordering.
When is a graph called dense versus sparse?
Dense: $|E|$ is close to $|V|^{2}$ (i.e., $|E| = \Theta(V^{2})$). Sparse: $|E|$ is close to $|V|$ (i.e., $|E| = O(V)$).
Compare space complexity of an adjacency matrix versus an adjacency list.
Adjacency matrix: $O(V^{2})$ space. Adjacency list: $O(V + E)$ space. Lists are preferred for sparse graphs; matrices for dense graphs.
How long does it take to check whether edge $(u,v)$ exists in an adjacency matrix versus an adjacency list?
Adjacency matrix: $O(1)$. Adjacency list: $O(\deg(u))$ in the worst case.
What is the time to iterate over all neighbors of a vertex $u$ in each representation?
Adjacency list: $O(\deg(u))$. Adjacency matrix: $O(V)$, since the entire row must be scanned.
State the Handshaking Lemma for undirected graphs.
The sum of all vertex degrees equals twice the number of edges: $$\sum_{v \in V} \deg(v) = 2|E|.$$
What data structure does BFS use, and what order does it explore vertices?
BFS uses a FIFO queue and explores vertices in order of increasing distance (level by level) from the source.
State the time and space complexity of BFS on a graph with adjacency lists.
Time: $O(V + E)$. Space: $O(V)$ for the queue and visited/distance arrays.
What problem does BFS solve optimally, and under what edge-weight condition?
BFS finds shortest paths (fewest edges) from a source in an unweighted graph, or equivalently when all edge weights are equal.
What data structure underlies DFS, and how can it be implemented?
DFS uses a LIFO stack, implemented either with explicit recursion (call stack) or an explicit stack.
State the time and space complexity of DFS with adjacency lists.
Time: $O(V + E)$. Space: $O(V)$ for the recursion stack and visited array.
In DFS, what are tree edges, back edges, forward edges, and cross edges?
Tree edge: to an unvisited vertex. Back edge: to an ancestor (indicates a cycle). Forward edge: to a descendant already finished. Cross edge: between unrelated subtrees. In undirected DFS only tree and back edges occur.
How does DFS detect a cycle in a directed graph?
A directed graph has a cycle if and only if DFS encounters a back edge—an edge to a vertex currently on the recursion stack (in the 'gray'/in-progress state).
Define a topological sort of a DAG.
A linear ordering of vertices such that for every directed edge $(u,v)$, $u$ appears before $v$. It exists if and only if the graph is a DAG.
Describe Kahn's algorithm for topological sorting.
Repeatedly remove a vertex with in-degree $0$, append it to the order, and decrement the in-degree of its neighbors. Uses a queue of zero-in-degree vertices; runs in $O(V + E)$. If vertices remain with nonzero in-degree, a cycle exists.
How does DFS produce a topological order?
Run DFS and push each vertex onto a stack when it finishes (post-order). The reversed finish order is a valid topological sort. Runs in $O(V + E)$.
What problem does Dijkstra's algorithm solve, and what is its key edge-weight restriction?
Single-source shortest paths in a graph with non-negative edge weights. It fails if any edge weight is negative.
State Dijkstra's running time with a binary heap and with a Fibonacci heap.
Binary heap: $O((V + E)\log V)$. Fibonacci heap: $O(E + V\log V)$.
Planning Graphs & Advanced Structures for Data Structures & Algorithms
Graphs & Advanced Structures is about 15% of the Data Structures & Algorithms syllabus by topic count — 17 of 111 topics, spread over 6 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 15 hours.
The heaviest chapters are Shortest Path Algorithms (4 topics), Graph Traversal (3 topics), Disjoint Set Union (3 topics) . Front-load those while your energy is high; the short chapters are better revision filler later.
Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.
Graphs & Advanced Structures (Data Structures & Algorithms) FAQ
What is in the Data Structures & Algorithms Graphs & Advanced Structures syllabus?
Graphs & Advanced Structures is split into 6 chapters — Graph Representation, Graph Traversal, Shortest Path Algorithms, Minimum Spanning Trees, Disjoint Set Union and Advanced Graph Topics, containing 17 topics and 0 sub-topics in total.
How is Graphs & Advanced Structures structured in the Data Structures & Algorithms syllabus?
6 chapters. Graphs & Advanced Structures accounts for about 15% of the topics in the whole Data Structures & Algorithms syllabus (17 of 111).
How long should I spend on Graphs & Advanced Structures for Data Structures & Algorithms?
Budget around 15 hours for a first pass through Graphs & Advanced Structures — about 45 minutes per topic plus 12 minutes per sub-topic across its 17 topics. Add revision cycles on top.
Are there flashcards for Data Structures & Algorithms Graphs & Advanced Structures?
Yes — a 56-card Graphs & Advanced Structures deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.