- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

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.

**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 **a ** represents an endpoint of an edge. An edge joins two vertices **a, b ** and is represented by set of vertices it connects.

**Example** − Let us consider, a Graph is G = (V, E) where V = {a, b, c, d} and E = {{a, b}, {a, c}, {b, c}, {c, d}}

Here V is verteces and a, b, c, d are various vertex of the graph.

Here E represents edges and {a, b}, {a, c}, {b, c}, {c, d} are various edge 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 the vertex V.

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, the vertex is called an even vertex and if the degree of a vertex is odd, the vertex is called an odd vertex.

**Degree of a Graph** − The degree of a graph is the largest vertex degree of that graph. For the above graph the degree of the graph is 3.

**The Handshaking Lemma** − In a graph, the sum of all the degrees of all the vertices is equal to twice the number of edges. For example, in above case, sum of all the degrees of all vertices is 8 and total edges are 4.

- Related Questions & Answers
- Maximum and minimum isolated vertices in a graph in C++
- Maximum number of edges in Bipartite graph in C++
- Construct a graph from given degrees of all vertices in C++
- Count number of edges in an undirected graph in C++
- Program to find the diameter, cycles and edges of a Wheel Graph in C++
- Check whether given degrees of vertices represent a Graph or Tree in Python
- Distance between Vertices and Eccentricity
- C++ Program to Find All Forward Edges in a Graph
- Finding the simple non-isomorphic graphs with n vertices in a graph
- Sum of Degrees of Vertices Theorem
- C++ Program to Generate a Random UnDirected Graph for a Given Number of Edges
- C++ Program to Find Minimum Number of Edges to Cut to make the Graph Disconnected
- Program to Find Out the Edges that Disconnect the Graph in Python
- C++ Program to Generate a Random Directed Acyclic Graph DAC for a Given Number of Edges
- Maximum number of edges to be added to a tree so that it stays a Bipartite graph in C++

Advertisements