Introduction
A graph models objects and pairwise connections between them: computers and links, cities and roads, tasks and conflicts, states and transitions. Graph theory supplies the vocabulary (degree, path, cycle, tree, planar) and the counting facts used in connectivity, matching and colouring. Algorithms on graphs (search, shortest paths, spanning trees) build on the same definitions, and the way a graph is stored in memory is covered in Graph Representations.
Prerequisites
- Sets: a graph is a pair of sets; counts 2-element subsets.
Core concepts
Definitions and conventions
A graph has a set of vertices and a set of edges; each edge joins two vertices, its endpoints. We write and .
Graph conventions used in these notes.
- Unless stated otherwise, "graph" means a simple undirected graph: no loops (edge from a vertex to itself) and no multiple edges between the same pair. Then an edge is a 2-element subset and .
- A multigraph allows multiple edges; a pseudograph also allows loops. A directed graph (digraph) has ordered pairs as arcs.
- Degree is the number of edge ends at . A loop counts twice toward the degree of its vertex, so the handshake lemma below holds for pseudographs too.
- In a digraph, (in-degree) and (out-degree) count arcs entering and leaving .
Further terms: and are adjacent if ; the edge is incident to both. and denote the minimum and maximum degree. A vertex of degree 0 is isolated; of degree 1, a leaf (pendant vertex). A graph is -regular if every vertex has degree .
The handshake lemma
Each edge contributes exactly 2 to the sum (one to each end, or 2 to one vertex if it is a loop). Consequences:
- The number of odd-degree vertices is even.
- A -regular graph on vertices has edges, so must be even (no 3-regular graph on 7 vertices exists).
- For a digraph, .
- Average degree is , so .
Degree sequences
The degree sequence lists degrees in non-increasing order. A sequence is graphic if some simple graph realises it. Necessary conditions: even sum, every entry at most . They are not sufficient: has even sum and entries at most 3 but is not graphic (two vertices of degree 3 must each be adjacent to all three others, forcing the last two vertices to degree at least 2).
Havel-Hakimi test: a non-increasing sequence with is graphic if and only if the sequence obtained by deleting and subtracting 1 from each of the next entries is graphic. Repeat until all entries are 0 (graphic) or some entry becomes negative or the first entry exceeds the number of remaining entries (not graphic).
Example: : graphic.
Special graphs
| Graph | Description | Degrees | ||
|---|---|---|---|---|
| Complete graph | every pair adjacent | all | ||
| Cycle , | one cycle through all vertices | all 2 | ||
| Path | vertices in a line | for : two of degree 1, rest 2; : one vertex of degree 0 | ||
| Wheel , | plus a hub joined to all | hub , rim 3 | ||
| Complete bipartite | parts of size , all cross edges | in one part, in the other | ||
| Hypercube | bit strings of length , adjacent if they differ in one bit | all | ||
| Star | one centre joined to leaves | centre , leaves 1 |
Index conventions vary: some books write for the wheel with vertices in total. The notation used is = hub + (as in Rosen).

Bipartite graphs
is bipartite if splits into two sets such that every edge has one end in each. Theorem: a graph is bipartite if and only if it has no cycle of odd length. A breadth-first search that 2-colours vertices by level parity tests this in time. A bipartite graph on vertices has at most edges (attained by ).
Subgraphs, complements, isomorphism
- is a subgraph of if and . It is induced if it contains every edge of between its vertices; spanning if .
- The complement has the same vertices and exactly the edges missing from : . A self-complementary graph is isomorphic to its complement, which forces even, so or .
- and are isomorphic if a bijection preserves adjacency in both directions. Invariants (equal in isomorphic graphs): , , degree sequence, number of cycles of each length, connectedness, bipartiteness. Matching invariants do not prove isomorphism; one differing invariant disproves it.
- The number of labelled simple graphs on a fixed set of vertices is ; the number with exactly edges is .
Walks, paths, cycles
- A walk is a sequence of vertices with consecutive ones adjacent; its length is the number of edges.
- A trail repeats no edge; a path repeats no vertex. A cycle is a closed path of length at least 3.
- The number of walks of length from to is the entry of , where is the adjacency matrix.
- If every vertex has degree at least 2, the graph contains a cycle. A connected graph with vertices and no cycle is a tree and has exactly edges; a forest with components has edges. Trees are developed in Trees and Binary Trees.
Euler and Hamiltonian graphs
- An Euler circuit traverses every edge exactly once and returns to its start; an Euler path (trail) traverses every edge exactly once.
- Euler's theorem. A connected (multi)graph, ignoring isolated vertices, has an Euler circuit if and only if every vertex has even degree, and an Euler path but no Euler circuit if and only if exactly two vertices have odd degree (the path starts at one and ends at the other).
- A Hamiltonian cycle visits every vertex exactly once and returns; a Hamiltonian path visits every vertex exactly once. No simple necessary-and-sufficient condition is known, and deciding it is NP-complete.
- Sufficient conditions (simple graph, ): Dirac: . Ore: for every pair of non-adjacent . These are not necessary: is Hamiltonian with all degrees 2.
- Necessary condition: for every nonempty in a Hamiltonian graph, . A bipartite graph with unequal part sizes has no Hamiltonian cycle.

Planar graphs
A graph is planar if it can be drawn in the plane with no crossing edges. A planar drawing divides the plane into faces (regions), including the unbounded outer face.
- Euler's formula: for a connected planar graph, ; with components, .
- For a simple connected planar graph with : . If it also has no triangle (for example, if it is bipartite): .
- Consequences: () and () are non-planar. Every simple planar graph has a vertex of degree at most 5.
- Kuratowski's theorem: a graph is planar if and only if it has no subgraph that is a subdivision of or .
- The bounds and are necessary, not sufficient: satisfying them does not prove planarity.
Worked examples
Example 1: handshake
A simple graph has 12 edges, 2 vertices of degree 4, 4 vertices of degree 3, and all others of degree 2. Sum of degrees , so vertices of degree 2 and .
Example 2: planar faces
A connected planar simple graph has 10 vertices, each of degree 3. Then and .
Example 3: Euler paths
The graph of the seven bridges of Konigsberg has four land masses with degrees 5, 3, 3, 3: four odd vertices, so neither an Euler circuit nor an Euler path exists. has an Euler circuit if and only if is odd (all degrees even). has an Euler circuit if and only if and are both even.
Example 4: counting graphs
On the vertex set there are labelled simple graphs, of them with exactly 3 edges. Up to isomorphism there are only 11 simple graphs on 4 vertices.
Important properties and observations
- In any simple graph with , two vertices have the same degree (pigeonhole: degrees 0 and cannot both occur).
- or is connected (for every ).
- is bipartite (split by parity of the number of 1 bits) and Hamiltonian for (Gray code).
- A tree with vertices has at least two leaves.
- has distinct Hamiltonian cycles for .
GATE examination perspective
- Counting edges and vertices. Handshake lemma, special-graph formulas, Euler's formula for planar graphs.
- Degree-sequence questions. Check parity, maximum degree, then Havel-Hakimi.
- Euler and Hamilton. Euler: parity of degrees, an exact characterisation. Hamilton: only sufficient conditions (Dirac, Ore) and necessary obstacles.
- Planarity. Use (or without triangles) to rule out planarity.
- Trap: whether loops count once or twice. These notes count a loop twice.
- Trap: Dirac's and Ore's conditions are sufficient, not necessary.
Summary
Sources
- K. H. Rosen, Discrete Mathematics and Its Applications, 7th ed., McGraw-Hill, 2012: Sections 10.1 to 10.5 and 10.7 (graphs and graph models, graph terminology and special types of graphs, representing graphs and graph isomorphism, connectivity, Euler and Hamilton paths, planar graphs).
- D. B. West, Introduction to Graph Theory, 2nd ed., Prentice Hall, 2001: Chapter 1 (Fundamental Concepts).