# What Is Complete Graph in Data Structure With Example?

//

Angela Bailey

What Is Complete Graph in Data Structure With Example?

A complete graph is a type of graph in data structure that contains all possible edges between its vertices. In other words, every vertex in a complete graph is connected to every other vertex.

## Properties of Complete Graph

• Vertices: A complete graph with ‘n’ vertices has a total of n(n-1)/2 edges.
• Degree: Each vertex in a complete graph has a degree of n-1, where ‘n’ is the total number of vertices.
• Connectivity: There is a direct edge between every pair of vertices in a complete graph.

## Example

Let’s consider an example to understand the concept better. Suppose we have a complete graph with 4 vertices: A, B, C, and D. In this case, we can connect each vertex to every other vertex using edges as follows:

• A — B
• A — C
• A — D
• B — C
• B — D
• C — D

This complete graph has a total of (4 * (4-1))/2 = 6 edges, and each vertex has a degree of 3 (n-1 = 4-1 = 3).

## Applications of Complete Graphs

Complete graphs find applications in various fields such as:

• Social Networks: Complete graphs can model social networks where every person is connected to every other person.
• Transportation Networks: Complete graphs can represent transportation networks where each location is directly connected to all other locations.
• Optimization: Complete graphs are used in optimization problems, such as finding the shortest path or minimum spanning tree.

## In Conclusion

A complete graph in data structure is a graph where every vertex is connected to all other vertices. It has several properties, including the number of edges and the degree of each vertex.

Complete graphs have various applications in different fields, such as social networks and transportation networks. Understanding complete graphs can be beneficial when solving optimization problems or analyzing complex interconnected systems.

Privacy Policy