Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Edges and Vertices of Graph
A graph is a set of points, called nodes or vertices, which are interconnected by a set of lines called edges. The study of graphs, or graph theory, is an important part of a number of disciplines in the fields of mathematics, engineering, and computer science.
Graph Definition
A graph (denoted as G = (V, E)) consists of a non-empty set of vertices (or nodes) V and a set of edges E. A vertex represents an endpoint of an edge. An edge joins two vertices and is represented by the set of vertices it connects.
Example
Let us consider a graph G = (V, E) where V = {a, b, c, d} and E = {{a, b}, {a, c}, {b, c}, {c, d}} ?
Here V = {a, b, c, d} are the vertices and E = {{a,b}, {a,c}, {b,c}, {c,d}} are the edges of the graph.
Degree of a Vertex
The degree of a vertex V of a graph G (denoted by deg(V)) is the number of edges incident with (connected to) that vertex.
For the graph above, the degree of each vertex is −
| Vertex | Degree | Even / Odd |
|---|---|---|
| a | 2 | Even |
| b | 2 | Even |
| c | 3 | Odd |
| d | 1 | Odd |
Even and Odd Vertex
If the degree of a vertex is even, it is called an even vertex. If the degree of a vertex is odd, it is called an odd vertex. In the graph above, vertices a and b are even vertices (degree 2), while c and d are odd vertices (degrees 3 and 1).
Degree of a Graph
The degree of a graph is the largest vertex degree in that graph. For the above graph, the degree of the graph is 3 (the degree of vertex c).
The Handshaking Lemma
In any graph, the sum of the degrees of all vertices is equal to twice the number of edges −
∑ deg(Vi) = 2 × |E|
For the above graph −
Sum of degrees = deg(a) + deg(b) + deg(c) + deg(d)
= 2 + 2 + 3 + 1
= 8
Number of edges = |E| = 4
2 × |E| = 2 × 4 = 8 ?
The sum of all degrees (8) equals twice the number of edges (2 × 4 = 8), confirming the Handshaking Lemma.
Conclusion
Vertices are the points and edges are the connections in a graph. The degree of a vertex counts its incident edges, and the Handshaking Lemma guarantees that the sum of all vertex degrees always equals twice the total number of edges.
