Kahibaro
Discord Login Register

Graph Theory

Understanding Graph Theory

Graph theory is the study of structures made from “things” and the “connections” between them. The things are called vertices (or nodes), and the connections are called edges. Many problems in computer science, network design, social networks, transportation, and puzzles can be modeled using graphs.

This chapter introduces the core ideas of graph theory that you need before looking specifically at “Graphs” and “Trees” in their own chapters.

Basic Vocabulary

A graph $G$ consists of:

We write:
$$
G = (V, E)
$$
to mean “$G$ is a graph with vertex set $V$ and edge set $E$.”

An edge connects two vertices. In a simple picture-style graph, you draw dots (vertices) and lines between them (edges).

Types of edges

You will meet more detail in the later “Graphs” chapter, but here are the broad categories:

A graph with only undirected edges is an undirected graph.
A graph with directed edges is a directed graph (or digraph).

Sometimes edges can also carry extra information such as a cost, distance, or capacity. These are called weighted graphs. The number written on an edge is its weight.

Simple Graphs and Related Variants

There are many kinds of graphs. One very common kind is a simple graph.

A graph is called simple if:

If a graph can have:

Simple graphs do not allow multiple edges or loops.

Degree of a Vertex

In an undirected graph, the degree of a vertex is the number of edges that touch that vertex.

If $v$ is a vertex, the degree of $v$ is written $\deg(v)$.

A vertex with degree 0 is called an isolated vertex. It has no edges.

Degree in directed graphs

In a digraph (directed graph), each vertex has:

These are written, for example, as:

Paths, Walks, and Cycles

Graph theory often studies ways of “moving” through the graph along edges.

Let $G=(V,E)$ be a graph.

For directed graphs, we talk about directed walks, directed paths, and directed cycles, where you must follow the direction of each edge.

Length

The length of a walk, path, or cycle is the number of edges it uses.

For example:

Connectedness

Connectedness describes whether all vertices in a graph are reachable from each other.

In an undirected graph:

A connected component is a maximal connected subgraph: a part of the graph such that any two vertices in that part are connected by a path, and you cannot add any other vertex from the graph without losing this property.

In a directed graph, there are different notions:

These notions will reappear when you study directed graphs in more detail.

Subgraphs

A subgraph of a graph $G = (V, E)$ is another graph $H = (V_H, E_H)$ such that:

That is, a subgraph is formed by choosing some of the vertices and some of the edges from the original graph.

A spanning subgraph is a subgraph that uses all the vertices of the original graph (so $V_H = V$), but maybe not all of the edges.

A connected spanning subgraph that has no cycles is called a spanning tree of a connected graph (trees will be studied in their own chapter).

Special Types of Graphs

Certain graph structures appear so often that they have their own names.

Complete graphs

A complete graph on $n$ vertices, written $K_n$, is a simple undirected graph in which every pair of distinct vertices is connected by an edge.

Complete graphs represent situations where every “thing” is connected to every other.

Bipartite graphs

A graph is bipartite if its vertices can be divided into two sets, say $A$ and $B$, such that:

Bipartite graphs are often used to model relationships between two different kinds of objects (for example, jobs and workers, customers and products).

A complete bipartite graph with parts of size $m$ and $n$ is denoted $K_{m,n}$. Every vertex in one part is connected to every vertex in the other part.

Regular graphs

A graph is $k$-regular if every vertex has the same degree $k$.

For example:

Regular graphs are often symmetric and appear in many combinatorial constructions.

Graph Isomorphism (Same Shape)

Two graphs can look different when drawn, yet really be the same in structure.

Two graphs $G_1 = (V_1, E_1)$ and $G_2 = (V_2, E_2)$ are isomorphic if there is a one-to-one correspondence (a bijection) between their vertex sets that preserves edges.

Informally:

Graph isomorphism is how we formalize the idea that two graphs have the same shape, even if drawn differently.

Planar Graphs and Graph Drawings

Graphs are often drawn on a plane (a flat piece of paper).

A graph is planar if it can be drawn in the plane with edges as curves such that:

If a graph can be drawn with no edges crossing, it has a planar embedding.

Planar graphs are connected to maps, regions, and famous results like Euler’s formula for planar graphs, which relates the number of vertices, edges, and faces in such a drawing.

Graph Coloring

A vertex coloring of a graph assigns a “color” (or label) to each vertex so that:

The smallest number of colors needed for such a coloring is called the graph’s chromatic number, often written $\chi(G)$.

Graph coloring is used in scheduling problems, map coloring, and resource allocation, where “colors” represent limited resources that cannot be shared by conflicting items.

Graph Theory and Algorithms

Graph theory is deeply linked with algorithms.

Graphs provide a way to model:

Some famous algorithmic problems in graph theory include:

Specific algorithms and their details belong to more advanced or specialized chapters, but the modeling step—translating a real-world problem into a graph—is a core skill introduced here.

Summary

Graph theory studies:

Later chapters “Graphs” and “Trees” will delve deeper into particular structures and their more precise properties and theorems.

Views: 10

Comments

Please login to add a comment.

Don't have an account? Register now!