Definition
A graph consists of:
- : a set of vertices (nodes)
- : a set of edges (connections between vertices)
Types of Graphs
Undirected Graph
Edges have no direction: connects and symmetrically.
Directed Graph (Digraph)
Edges have direction: goes from to .
Simple Graph
- No loops (edges from vertex to itself)
- No multiple edges between same vertices
Multigraph
Multiple edges between vertices allowed.
Pseudograph
Loops and multiple edges allowed.
Weighted Graph
Each edge has an associated numerical value (weight).
Basic Terminology
Vertices
| Term | Definition |
|---|---|
| Adjacent | Two vertices connected by an edge |
| Neighbor | A vertex adjacent to |
| Degree | Number of edges incident to |
| Isolated vertex | Vertex with degree 0 |
| Pendant vertex | Vertex with degree 1 |
Edges
| Term | Definition |
|---|---|
| Incident | Edge is incident to vertices it connects |
| Loop | Edge connecting vertex to itself |
| Multiple edges | Two or more edges between same vertices |
Degree
Undirected Graphs
(Loops count twice)
Handshaking Lemma
Each edge contributes 2 to the total degree.
Corollary: The number of vertices with odd degree is even.
Directed Graphs
- In-degree : edges coming into
- Out-degree : edges going out of
Graph Representations
Adjacency List
For each vertex, list its neighbors.
Example: Triangle (vertices 1, 2, 3)
1: [2, 3]
2: [1, 3]
3: [1, 2]
Space:
Adjacency Matrix
if edge between and , else 0.
Example: Triangle
Space:
Incidence Matrix
Rows = vertices, Columns = edges. if is incident to .
Special Graphs
Complete Graph
Every pair of vertices is connected.
- Vertices:
- Edges:
- Each vertex has degree
Complete Bipartite Graph
Vertices split into two groups of size and . Every vertex in one group connected to every vertex in the other.
- Edges:
Cycle
vertices in a cycle. Each vertex has degree 2.
Path
vertices in a line. Two endpoints have degree 1, others have degree 2.
Wheel
Cycle plus a central hub connected to all cycle vertices.
- Vertices:
- Edges:
n-Cube
Vertices are -bit binary strings. Edge between two vertices if they differ in exactly one bit.
- Vertices:
- Edges:
- Regular with degree
Subgraphs
is a subgraph of if:
- All edges in have endpoints in
Induced Subgraph
Given , the induced subgraph includes all edges of with both endpoints in .
Spanning Subgraph
A subgraph that includes all vertices of .
Graph Operations
Union
Complement
has the same vertices as , with edge iff is NOT in .
For simple graphs:
Contraction
Remove an edge and merge and into a single vertex.