Undergraduate → Discrete Mathematics ↓
Graph Theory
Graph theory is a fascinating field of mathematics that deals with the study of graphs. Graphs are mathematical structures used to model paired relationships between objects. They are composed of vertices, also called nodes, and edges, which connect pairs of vertices. Graph theory has applications in various fields such as computer science, biology, social sciences, transportation, and many more.
Basic concepts
Top and sides
In graph theory, a graph G
is defined as an ordered pair G = (V, E)
, where:
V
is a set of vertices.E
is a set of edges, where each edge is a pair of vertices.
For example, consider a graph in which the vertices represent cities and the edges represent roads connecting the cities.
Visual example
In the above example, the circles represent vertices, and the lines represent edges connecting the vertices.
Types of graphs
- Undirected Graph: In an undirected graph, edges have no direction. Edge
(u, v)
is the same as(v, u)
. - Directed Graph (Digraph): In a directed graph, each edge has a direction. Here, edge
(u, v)
is different from(v, u)
.
Visual example: guided vs. unguided
The left side of the above visual illustration shows a directed graph, while the right side shows an undirected graph.
Paths and cycles
On the way of
A path in a graph is a sequence of vertices connected by edges. A path is defined as v1, v2, v3, ..., vn
where (vi, vi+1)
is an edge for all i
. Paths are fundamental concepts in determining how entities are connected in a graph.
Bicycle
A cycle is a path that starts and ends at the same vertex. It is a closed path. Cycles are important in many algorithms, especially in detecting infinite loops.
Example in graph
In the graph shown above, a graph represents a cycle that spans the vertices. This cycle starts and ends at the same vertex.
Affiliations and components
A graph is said to be connected if there is a path from any vertex in the graph to any other vertex. If a graph is not connected, it has many connected components, where each component is a subgraph in which any two vertices are connected to each other, but there is no relationship between vertices in different subgraphs.
Visual example of connected components
The two sets of connected vertices in the above visualization represent the concept of graph components. Each pair forms a separate connected subgraph within the larger graph.
Directed acyclic graphs (DAGs)
A directed acyclic graph, or DAG, is a type of directed graph with no cycles. This property makes DAGs suitable for representing structures with dependencies, such as task scheduling, dependency resolution, and Bayesian networks.
An important feature of DAGs is topological ordering, where we arrange the vertices in a linear order such that for every directed edge (u, v)
, the vertex u
comes before the vertex v
.
Example of a DAG
The above demonstration shows a directed acyclic graph without any cycles, which shows its function for applications such as dependency management.
Graph coloring
Graph coloring is the process of assigning colors to the vertices of a graph such that no two adjacent vertices share the same color. The minimum number of colors required to color a graph is called the chromatic number of the graph. This concept is important in solving problems where resources need to be allocated without any conflict.
Graph coloring example
Consider the task of scheduling classes by deadline. You have to ensure that no two classes are scheduled at the same time that have the same students. This is similar to coloring a graph.
The above example uses three colors to ensure that no two adjacent vertices have the same color, thus demonstrating the graph coloring process.
Trees and forests
A tree is a special type of graph that is connected and acyclic. A tree with n
vertices has exactly n - 1
edges. Trees are essential structures in graph theory, widely used in data structures, algorithms, and network design.
- Rooted tree: A rooted tree is a tree in which one vertex is designated as the root, and each edge is directed away from the root.
- Forest: A forest is a disjoint group of trees.
Tree example
The above graph shows a tree with a single root node, from which all branches extend directly.
Conclusion
Graph theory is a wide and interesting field in discrete mathematics. It enables us to understand and unravel complexities in networks, whether they are social connections, communications, or computing systems. This comprehensive exploration of the fundamental concepts of graph theory, augmented with simple illustrations, provides insights into limitless applications spanning various domains. Whether rendering the web, optimizing logistics, designing algorithms, or delving into the structures of proteins and DNA, graph theory remains a cornerstone for innovation and problem-solving in the modern world.