Graph theory is a branch of mathematics that studies the properties and applications of graphs. A graph is a collection of vertices (also called nodes) connected by edges (also called links). Graphs are used to model pairwise relations between objects, making them a powerful tool for representing and analyzing complex systems in various fields.
In this article, we will discuss all the fundamentals of graph theory, from its definition to its types, and various ways to represent graphs as well.
What is a Graph?
A graph is a mathematical structure used to model pairwise relations between objects. It consists of two primary components: vertices (also called nodes) and edges (also called links).
Definition of Graph
A graph G can be defined as an ordered pair (V,E) where:
- V is a set of vertices.
- E is a set of edges, where each edge is a pair of vertices from V.
For example, G = (V, E) is a graph such that,
- V = {a, b, c, d, e, f}
- E = {ab, af, bc, cd, de, ef}
This graph can be represented as follows:
Examples in Real Life
Some common real life examples of graphs are:
- Social Networks: Vertices represent people, and edges represent friendships.
- Transportation Networks: Vertices represent locations, and edges represent routes or connections.
- Computer Networks: Vertices represent computers or devices, and edges represent communication links.
Basic Concepts in Graph Theory
Some of the basic concepts in graph theory are:
Let's discuss these concepts in detail as follows:
Vertex or Nodes
A vertex is a point where lines meet in a graph and is denoted by an alphabet. It can also be called a node or a junction. In graph theory, a vertex is one of the points that the graph is defined on and can be connected by edges. It is often represented by alphabets, numbers, or alphanumeric values.
Edge or Links
In mathematics, a line that joins two vertices to form a link in a graph is called an edge. It can have more than one edge from a single vertex, but it must have a beginning and an ending vertex in order to exist. An edge can be directed (having a defined path) or undirected (having no direction), often referred to as a line, branch, link, or arc. It is analogous to having an undirected edge link two vertices when there are two directed edges between them. Therefore, in mathematical contexts, edges are essential for joining vertices and creating connections.
Multiple Edges
In graph theory, multiple edges (also known as parallel edges) refer to two or more edges that connect the same pair of vertices. Graphs that allow multiple edges between pairs of vertices are known as multigraphs.
Loop
A loop is a special type of graph where both endpoints of an edge are the same vertices or when an edge starts from itself and end on itself too, it is called a loop.
Types of Graphs
There are various types of graphs in graph theory, some of these are:
- Null Graph
- Trivial Graph
- Simple Graph
- Undirected Graph
- Directed Graph
- Weighted Graphs
- Complete Graph
- Bipartite Graphs
Let's discuss these types in detail as follows:
Null Graph
A null graph, also known as an empty graph, is a type of graph in which the vertex setV is non-empty, but the edge set E is empty.
In other words, a null graph has vertices but no edges connecting any pairs of vertices.
Consider a null graph with three vertices:
- Vertex set V: {A, B, C}
- Edge set E: { } or Ï•
Note: Each vertex in a null graph has a degree of zero, since there are no edges connected to any vertex.
Trivial Graph
A trivial graph is the simplest type of graph, consisting of exactly one vertex and no edges.
Consider a trivial graph with one vertices:
- Vertex set V: {A}
- Edge set E: { } or Ï•
Simple Graph
A simple graph is a type of graph in which each pair of vertices is connected by at most one edge, and no vertex has an edge to itself.
This means that a simple graph does not contain any loops (edges that connect a vertex to itself) or multiple edges between the same pair of vertices.
Consider a simple graph with four vertices:
- Vertex set V: {A, B, C, D}
- Edge set E: { {A, B}, {A, C}, {B, D}, {C, D} }
Undirected Graph
An undirected graph is a type of graph in which the edges have no direction.
This means that the relationship between any pair of connected vertices is mutual. In an undirected graph, the edge (u, v) is identical to the edge (v, u).
Consider an undirected graph with four vertices:
- Vertex set V: {A, B, C, D}
- Edge set E: { {A, B}, {A, C}, {B, D}, {C, D} }
Directed Graph
A directed graph, also known as a digraph, is a type of graph where the edges have a direction.
In other words, each edge has a starting vertex (source) and an ending vertex (destination), indicating a one-way relationship between the vertices.
Consider a directed graph with four vertices:
- Vertex set V: {A, B, C, D}
- Edge set E: { (A, B), (A, C), (B, D), (C, D)}
Weighted Graphs
A weighted graph is a type of graph in which each edge is assigned a weight (or cost).
These weights can represent various quantities such as distances, costs, capacities, or any other metric that quantifies the relationship between vertices.
Consider a weighted graph with four vertices
- Vertex set V: {A, B, C, D}
- Edge set E: { (A, B, 3), (A, C, 5), (B, D, 2), (C, D, 1) }
Complete Graph
If every vertex in a graph G is linked to every other vertex in the graph, then the graph is said to be complete. Therefore, every graph G has to be linked. Kn represents the whole graph with n vertices.
Consider a complete graph with four vertices:
- Vertex set V: {A, B, C, D}
- Edge set E: { {A, B}, {A, C}, {A, D}, {B, C}, {B, D}, {C, D} }
Note: Number of Edges in complete graphs with n vertices is n(n - 1)/2.
Bipartite Graphs
A bipartite graph is a type of graph where the vertex set can be divided into two disjoint sets such that no two vertices within the same set are adjacent.
This means that every edge in a bipartite graph connects a vertex in one set to a vertex in the other set.
Consider a bipartite graph with vertex sets:
- Vertex sets V1​: {A, B}, V2​: {C, D}
- Edge set E: { {A, C}, {A, D}, {B, C} }
Cycle Graph
A cycle graph, also known as a circular graph, is a type of graph that forms a single cycle.
In a cycle graph, each vertex has exactly two neighbors, creating a closed loop.
Consider a cycle graph C4​ with four vertices:
- Vertex set V: {A, B, C, D}
- Edge set E: {{A, B}, {B, C}, {C, D}, {D, A} }
Some other Important Graphs
Some other important graphs includes:
- Tree
- Eulerian Graph
- Hamiltonian Graph
Tree
A tree is a type of graph that is connected and acyclic.
In other words, a tree is a connected graph with no cycles. Trees are fundamental structures in graph theory and have numerous applications in computer science, biology, and other fields.
Consider a tree with five vertices:
- Vertex set V: {A, B, C, D, E}
- Edge set E: { {A, B}, {A, C}, {B, D}, {B, E} }
Eulerian Graph
An Eulerian graph is a graph in which there exists a trail, called an Eulerian trail, that visits every edge exactly once.
If this trail is a circuit (i.e., it starts and ends at the same vertex), it is called an Eulerian circuit.Eulerian graphs are named after the Swiss mathematician Leonhard Euler, who introduced this concept while solving the famous Seven Bridges of Königsberg problem.
Consider an undirected graph with vertices:
- V = {A, B, C, D}
- E = {{A,B}, {B,C}, {C,D}, {D,A}, {A,C}, {B,D}}
Hamiltonian Graph
A Hamiltonian graph is a graph that contains a Hamiltonian circuit, which is a cycle that visits each vertex exactly once and returns to the starting vertex.
If the graph contains a Hamiltonian path (a path that visits each vertex exactly once but does not necessarily return to the starting vertex), it is called a semi-Hamiltonian graph.
Consider a Hamiltonian graph with five vertices:
- V = {A, B, C, D, E}
- E = {{A,B}, {B,C}, {C,D}, {D,E}, {E,A}, {A,C}, {B,D}}
Representations of Graphs
Other then graphical representation, there are some more important representations of graphs such as
- Adjacency Matrix
- Adjacency List
- Incidence Matrix
Let's discuss these representation with examples:
Adjacency Matrix
An adjacency matrix is a way of representing a graph as a matrix of booleans (0s and 1s) or numbers. The matrix is a 2D array of size n × n, where n is the number of vertices in the graph.
Each cell a[i][j] in the matrix indicates whether there is an edge from vertex i to vertex j. In weighted graphs, the cell a[i][j] can contain the weight of the edge instead of a boolean value.
Consider an undirected graph with four vertices
- V = {A, B, C, D}
- E = {{A,B}, {A,C}, {B,C}, {C,D}}
The adjacency matrix for this graph is:
Adjacency List
An adjacency list is a way of representing a graph where each vertex has a list of all the vertices it is connected to.
This representation is particularly efficient for sparse graphs where the number of edges is much less than the number of vertices squared.
Consider an undirected graph with four vertices
- V = {A, B, C, D}
- E = {{A,B}, {A,C}, {B,C}, {C,D}}
The adjacency list representation for this graph is:
Vertex | Adjacent Vertices |
---|
A | B, C |
B | A, C |
C | A, B, D |
D | C |
Incidence Matrix
An incidence matrix is a way of representing a graph that shows the relationship between vertices and edges.
It is a 2D array of size n × m, where n is the number of vertices and m is the number of edges in the graph. Each cell in the matrix indicates whether a given vertex is incident to a given edge.
Consider an undirected graph with four vertices
- V = {A, B, C, D}
- E = {e1{A,B}, e2{A,C}, e3{B,C}, e4{C,D}, e5{B, D}}
The incidence matrix for this graph is:
Vertex / Edge | e1 (A-B) | e2 (A-C) | e3 (B-C) | e4 (C-D) | e5 (B-D) |
---|
A | 1 | 1 | 0 | 0 | 0 |
B | 1 | 0 | 1 | 0 | 1 |
C | 0 | 1 | 1 | 1 | 0 |
D | 0 | 0 | 0 | 1 | 1 |
Applications of Graph Theory
Some of the common applications of graph theory are:
- Graphs are used to simulate biological systems' interactions between molecules or genes, computer networks' communication linkages, transportation networks' roads and routes, and social networks' friendships and relationships between individuals.
- Graphs are used by recommendation systems to make content or connection suggestions depending on user interactions.
- All things considered, graphs are a versatile tool for connection analysis in various settings.
- Graphs are fundamental in mathematics, especially in combinatorial problems and proofs. Topology studies graph characteristics under transformations.
- Computer Science Data Structures include trees, heaps, and hash maps implemented using graphs. Computer networks are graphically represented with computers or routers as vertices and connections as edges.
- Graph theory algorithms include Prim's, Kruskal's, Ford-Fulkerson, Dijkstra's, and Bellman-Ford.
- Language syntax trees show syntactic structure while semantic networks represent semantic relationships between words and concepts.
Similar Reads
Applications of Graph Theory
Applications of Graph Theory: In mathematics and computer science, a graph is a mathematical structure that consists of two main components: vertices (or nodes) and edges. The study of these graphs in various contexts is called graph theory. There are various applications of graph theory in real lif
9 min read
Outdegree of a Graph
Outdegree of a vertex is defined as the number of outgoing edges from a vertex in a directed graph. Significance of Outdegree:The outdegree of a directed graph vertex, which reflects the total number of edges emanating from that node, is always positive and never negative.If a directed graph's verte
2 min read
Graph Theory with R
Graph theory is a branch of mathematics that deals with the study of graphs, which are mathematical structures used to model pairwise relations between objects. A graph consists of a set of vertices (or nodes) and a set of edges (or arcs) connecting these vertices. graph theory plays a fundamental r
7 min read
Data Mining Graphs and Networks
Data mining is the process of collecting and processing data from a heap of unprocessed data. When the patterns are established, various relationships between the datasets can be identified and they can be presented in a summarized format which helps in statistical analysis in various industries. Am
13 min read
Applications of Graph Data Structure
A graph is a non-linear data structure, which consists of vertices(or nodes) connected by edges(or arcs) where edges may be directed or undirected. In Computer science graphs are used to represent the flow of computation.Google maps uses graphs for building transportation systems, where intersection
3 min read
Matching (Graph Theory)
Matching (Graph Theory): In graph theory, matching is a fundamental concept used to describe a set of edges without common vertices. Matchings are used in various applications such as network design, job assignments, and scheduling. Understanding matchings is essential for solving problems involving
4 min read
Graph terminology in data structure
Graphs are fundamental data structures in various computer science applications, including network design, social network analysis, and route planning. Understanding graph terminology is crucial for effectively navigating and manipulating graph data structures. In this article, we will discuss the g
5 min read
Dense Graph
Graphs are fundamental structures in computer science and mathematics used to model relationships between objects. Understanding the various types of graphs is essential for anyone working in fields like data analysis, networking, and algorithm design. One such type is the dense graph. In this artic
9 min read
Graph Clustering Methods in Data Mining
Technological advancement has made data analysis and visualization easy. These include the development of software and hardware technologies. According to Big Data, 90% of global data has doubled after 1.2 years since 2014. In every decade we live, we can attest that data analysis is becoming more s
5 min read
Basic Elements of Signal Flow Graph
Signal Flow Graphs are a crucial component of control systems. Furthermore, the control system is one of the most significant subjects in Electronics. It is primarily covered in the sixth semester of the B.Tech syllabus, though individual universities may alter it based on their syllabus hierarchy.
10 min read