Graph definitions
Vertices, edges and the vocabulary — directed, undirected, degree, path, cycle, connected, weighted.
Syllabus says: “Graphs: Definitions”
On this page · 7 sections
Sum of all degrees = 2 × edges (each edge has two ends). Complete graph on n vertices has n(n − 1)/2 edges.
Kerala's district map: districts are vertices, roads between them are edges, distances are weights, and a one-way road is a directed edge.
A graph G = (V, E) consists of a finite non-empty set of vertices V and a set of edges E, where each edge connects a pair of vertices; the pairs are ordered in a directed graph and unordered in an undirected graph.
What you will be able to do
- Define graphs and their types.
- Use the terms degree, path, cycle, connected, component and weighted graph.
Terminology
| Term | Meaning |
|---|---|
| Undirected graph | edge (u, v) is the same as (v, u) |
| Directed graph (digraph) | edge <u, v> goes from u (tail) to v (head) |
| Adjacent | u and v are adjacent if an edge joins them |
| Degree | number of edges at a vertex; digraphs have in-degree and out-degree |
| Path | a sequence of vertices with an edge between each consecutive pair |
| Simple path | a path with no repeated vertices |
| Cycle | a simple path whose first and last vertices are the same |
| Connected (undirected) | there is a path between every pair of vertices |
| Strongly connected (directed) | there is a directed path from every vertex to every other |
| Connected component | a maximal connected subgraph |
| Complete graph | every pair of vertices is adjacent: n(n − 1)/2 edges (undirected) |
| Weighted graph (network) | each edge carries a number (cost, distance, time) |
| Subgraph | G′ = (V′, E′) with V′ ⊆ V and E′ ⊆ E |
Σ degree(v) = 2|E| in an undirected graph, because each edge adds 1 to the degree of both its ends. In a digraph, Σ in-degree = Σ out-degree = |E|.
Graphs everywhere
- Road and rail networks (shortest routes).
- Social networks (friends of friends).
- Web pages and links (search engines).
- Task dependencies in a project (directed acyclic graphs).
Quick check — can you get them all?
Practice
Every visualizer has a Practice mode: predict the next state before the animation reveals it. You can also work through the topic's question set on the practice page.
Exam-ready summary
- G = (V, E); directed vs undirected; weighted.
- Degree, path, simple path, cycle, connected, strongly connected, component.
- Σ degrees = 2|E|; complete graph has n(n − 1)/2 edges.
References
- Horowitz, Sahni & Anderson-Freed, Fundamentals of Data Structures in C, 2/e — §6.1 (The graph abstract data type)
- Cormen, Leiserson, Rivest & Stein, Introduction to Algorithms, 3/e — Appendix B.4
Explanations on this page are original. Textbook references point to where the standard treatment can be read; no text is reproduced from them.
Prefer revising from notes? Module-wise notes and question papers on Azhimathi Mayam (opens in a new tab)