Graph Theory Basics - Core Definitions
Graph theory provides a mathematical framework for studying pairwise relationships between objects. Graphs model networks, connections, and structures across computer science, operations research, social sciences, and pure mathematics.
A graph consists of:
- A set of vertices (or nodes)
- A set of edges, where each edge connects two vertices
An edge between vertices and is denoted or simply . If edge exists, we say and are adjacent or neighbors, and is incident to both and .
Graphs can be undirected (edges have no direction) or directed (each edge has a source and target vertex, forming a digraph). Unless stated otherwise, we consider simple undirected graphs: no multiple edges between vertices and no loops (edges from a vertex to itself).
The degree of a vertex , denoted or , is the number of edges incident to . In a directed graph, we distinguish in-degree (incoming edges) and out-degree (outgoing edges).
A vertex with degree 0 is isolated. A vertex with degree 1 is a leaf (or pendant vertex).
In any graph , the sum of all vertex degrees equals twice the number of edges:
This follows because each edge contributes 1 to the degree of each of its two endpoints. A corollary: every graph has an even number of odd-degree vertices (since the sum must be even).
A path in a graph is a sequence of vertices where each consecutive pair is connected by an edge. The length of the path is (the number of edges).
A path is simple if no vertex is repeated. A cycle is a path where and all other vertices are distinct. The girth of a graph is the length of its shortest cycle (or if acyclic).
A graph is connected if there exists a path between every pair of vertices. A connected component is a maximal connected subgraph.
The distance between vertices and is the length of the shortest path between them (or if no path exists). The diameter of a connected graph is .
- Complete graph : Graph with vertices where every pair is connected ()
- Cycle graph : Graph forming a single cycle of vertices
- Path graph : Graph forming a single path of vertices
- Bipartite graph: Vertices can be partitioned into two sets such that all edges connect vertices from different sets
- Complete bipartite graph : Bipartite graph with parts of size and where all possible edges exist
Graph theory originated with Euler's 1736 solution to the Seven Bridges of KΓΆnigsberg problem, which asked whether one could walk through the city crossing each bridge exactly once. Euler proved this impossible by modeling bridges as edges and landmasses as vertices, showing the problem required a path visiting every edge exactly once (an Eulerian path), which exists only if the graph has at most two odd-degree vertices. This problem launched graph theory as a mathematical discipline.
These foundational concepts enable precise analysis of network structures and relationship patterns across diverse applications.