An undirected graph is a fundamental concept in data structure that represents a collection of nodes or vertices connected by edges. Unlike directed graphs, undirected graphs do not have any specific direction associated with the edges.

## What is a Node?

In an undirected graph, a node or vertex represents an entity or an object. Each node can be labeled with unique identifiers or values that help in distinguishing one node from another. For example, consider a graph representing cities, where each node represents a city and is labeled with the name of the city.

## What is an Edge?

An edge connects two nodes in an undirected graph and represents a relationship or connection between them. Edges are typically represented by lines and can be labeled to indicate additional information about the relationship. In our city example, an edge can represent the existence of a road connecting two cities.

## Adjacency

In an undirected graph, adjacency refers to the property of two nodes being directly connected by an edge. If there is an edge between nodes A and B, we say that A and B are adjacent to each other. The adjacency relation in undirected graphs is symmetric; if A is adjacent to B, then B is also adjacent to A.

### Types of Undirected Graphs

Undirected graphs can be categorized based on certain characteristics:

**Connected Graph:**A connected graph is one where there exists a path between every pair of nodes. In other words, it is possible to reach any node from any other node in the graph.**Disconnected Graph:**A disconnected graph consists of two or more connected components, where each component itself is a connected subgraph.**Cyclic Graph:**A cyclic graph contains one or more cycles, which are paths that start and end at the same node, without repeating any edges.**Acyclic Graph:**An acyclic graph is one that does not contain any cycles. Trees are a special case of acyclic graphs.

## Applications of Undirected Graphs

Undirected graphs have numerous applications in various domains:

__Social Networks:__Undirected graphs can be used to model connections between individuals in social networks, with nodes representing people and edges representing friendships or relationships.__Transportation Networks:__Graphs can represent transportation networks, where nodes represent locations and edges represent roads or connections between them.__Computer Networks:__Undirected graphs are often used to model computer networks, with nodes representing devices and edges representing communication links.__Data Analysis:__Graphs are useful for analyzing relationships between data points, such as in recommendation systems or clustering algorithms.

## In Summary

An undirected graph is a data structure that represents a collection of nodes connected by edges. Nodes represent entities, while edges represent relationships between those entities.

Undirected graphs can be categorized based on connectivity and the presence of cycles. They find applications in various fields such as social networks, transportation systems, computer networks, and data analysis.

To summarize the key points covered:

- An undirected graph consists of nodes connected by edges without any specific direction.
- Nodes represent entities, while edges represent relationships between those entities.
- The adjacency relation in undirected graphs is symmetric; if A is adjacent to B, then B is also adjacent to A.
- Undirected graphs can be connected or disconnected, cyclic or acyclic.
- They have applications in social networks, transportation systems, computer networks, and data analysis.

Now that you understand the concept of undirected graphs in data structures, you can leverage this knowledge in solving various graph-related problems and implementing algorithms efficiently.