Graph

 Graph

 ๐Ÿ‘‰ Introduction to Graph๐Ÿ‘‡

A graph is a non-linear data structure used to represent relationships between different objects. It consists of a set of vertices (nodes) and a set of edges that connect pairs of vertices. Graphs are widely used in computer science to model real-world problems such as computer networks, social networks, transportation systems, and web page links.

Formally, a graph G is defined as G = (V, E), where:

  • V is a finite set of vertices (nodes)

  • E is a set of edges that connect the vertices 

  • Definition of Graph ๐Ÿ˜€

  • A graph is a non-linear data structure that consists of a finite set of vertices (nodes) and a set of edges that connect pairs of vertices.

    Formally, a graph is defined as:

    G = (V, E)

    where:
    • V is a set of vertices (nodes)

  • Simple Definition of Graph๐Ÿ‘‰

    A graph is a collection of vertices (nodes) and edges that connect the vertices.

  • E is a set of edges connecting the vertices
  • ๐Ÿ‘‰Types of Graph ๐Ÿ‘ˆ

  • Graphs can be classified into different types based on their structure and properties:


    1. Undirected Graph
      A graph in which edges have no direction. The connection between vertices is bidirectional.
      Example: Friendship network.



    1. Directed Graph (Digraph)
      A graph in which edges have a direction, represented by arrows.
      Example: One-way roads, web page links.


    2. Weighted Graph
      A graph in which each edge is assigned a weight or cost.
      Example: Distance between cities.


    3. Unweighted Graph
      A graph in which edges do not have weights; all edges are treated equally.


    4. Simple Graph
      A graph with no self-loops and no multiple edges between the same pair of vertices.


    5. Multigraph
      A graph that allows multiple edges between the same pair of vertices.

    6. Complete Graph
      A graph in which every vertex is connected to every other vertex.


    7. Connected Graph
      A graph in which there is a path between every pair of vertices.


    8. Disconnected Graph
      A graph in which at least one vertex is not connected to others.



    ๐Ÿ‘‰ Types of Graph (Short ):-๐Ÿ‘‡

  1. Undirected Graph – Edges have no direction.
  2. Directed Graph – Edges have direction.

  3. Weighted Graph – Edges have weights or costs.

  4. Unweighted Graph – Edges have no weights.

  5. Simple Graph – No loops or multiple edges.

  6. Complete Graph – Every vertex is connected to all others.

  7. Connected Graph – Path exists between every pair of vertices.

  8. Disconnected Graph – Some vertices are not connected.

  9. Cyclic Graph – Contains at least one cycle.


Example of Cyclic Graph


  1. Directed Acyclic Graph – Contains no cycles.

    Example of Directed Acyclic Graph 


   

Comments

Popular posts from this blog

Representation of Graph Data Structure"๐Ÿ˜Š

Graph Traversal :-"BFS"