Data Structures(Introduction to graphs and Types of Graphs)

 

Graphs in Data Structure:

A graph is a non-linear kind of data structure made up of nodes or vertices and edges. The edges connect any two nodes in the graph, and the nodes are also known as vertices.

what-is-graphs-in-data-structure

This graph has a set of vertices V= { 1,2,3,4,5} and a set of edges E= { (1,2),(1,3),(2,3),(2,4),(2,5),(3,5),(4,50 }.

Types of Graphs in Data Structures:

here are different types of graphs in data structures, each of which is detailed below.

1. Finite Graph

The graph G=(V, E) is called a finite graph if the number of vertices and edges in the graph is limited in number

FINITE-GRAPH-IN-GRAPHS-IN-DATA-STRUCTURE

2. Infinite Graph

The graph G=(V, E) is called a finite graph if the number of vertices and edges in the graph is interminable.

infinite-graph-data-structure.

3. Trivial Graph

A graph G= (V, E) is trivial if it contains only a single vertex and no edges.

trivial-graph-data-structure

4. Simple Graph

If each pair of nodes or vertices in a graph G=(V, E) has only one edge, it is a simple graph. As a result, there is just one edge linking two vertices, depicting one-to-one interactions between two elements.

simple-graph-data-structure

5. Multi Graph

If there are numerous edges between a pair of vertices in a graph G= (V, E), the graph is referred to as a multigraph. There are no self-loops in a Multigraph.

multi-graph-in-data-structure

6. Null Graph

It's a reworked version of a trivial graph. If several vertices but no edges connect them, a graph G= (V, E) is a null graph. 

null-graph-data-structure.

7. Complete Graph

If a graph G= (V, E) is also a simple graph, it is complete. Using the edges, with n number of vertices must be connected. It's also known as a full graph because each vertex's degree must be n-1.

complete-graph-in-data-structure.

8. Pseudo Graph

If a graph G= (V, E) contains a self-loop besides other edges, it is a pseudograph.

pseudo-graph-in-data-structure.

9. Regular Graph

If a graph G= (V, E) is a simple graph with the same degree at each vertex, it is a regular graph. As a result, every whole graph is a regular graph.

regular-graph-in-data-structure.

10. Weighted Graph

A graph G= (V, E) is called a labeled or weighted graph because each edge has a value or weight representing the cost of traversing that edge.

weighted-graph-in-data-structure

11. Directed Graph

A directed graph also referred to as a digraph, is a set of nodes connected by edges, each with a direction.

directed-graph-in-data-structure

12. Undirected Graph

An undirected graph comprises a set of nodes and links connecting them. The order of the two connected vertices is irrelevant and has no direction. You can form an undirected graph with a finite number of vertices and edges.

undirected-graph-in-data-structure.

13. Connected Graph

If there is a path between one vertex of a graph data structure and any other vertex, the graph is connected.

connected-graph-in-data-structure.

14. Disconnected Graph

When there is no edge linking the vertices, you refer to the null graph as a disconnected graph.

When there is no edge linking the vertices, you refer to the null graph as a disconnected graph.

diconnected-graph-in-data-structure.

15. Cyclic Graph

If a graph contains at least one graph cycle, it is considered to be cyclic.

cyclic-graph-in-data-structure

16. Acyclic Graph

When there are no cycles in a graph, it is called an acyclic graph.

acyclic-graph-in-data-structure

17. Directed Acyclic Graph

It's also known as a directed acyclic graph (DAG), and it's a graph with directed edges but no cycle. It represents the edges using an ordered pair of vertices since it directs the vertices and stores some data.

directed-acyclic-graph-in-data-structure

18. Subgraph

The vertices and edges of a graph that are subsets of another graph are known as a subgraph.

subgraph-in-data-structure

    

Comments

Popular posts from this blog

PHP Array Functions

String Functions in C Language(C Language)

Object Instance Working with Strings