Skip to main content

Data Structure - Introduction To Graphs




          A Beginners Introduction to Graphs Data Structure



Graphs are a non-linear data structure used widely in technical world applications to solve real-world problems. Graphs are basically the collection of nodes (vertices) and edges.


  • Google search, Google Maps, even social media sites use Graphs data structures to solve problems.

  • These data structures are so powerful that you won't even imagine how diverse their real-world applications can be.
          
    Real-world Applications:-

  • GPS System and Google Maps use graphs to find the shortest path from one destination to other.
  • Social Networks use graphs to represent connections between users.
  • The Google Search Algorithm uses graphs to determine the relevance of the search result.
  • Chemistry uses graphs to represent molecules.
         

                                 GRAPH SUB-OPERATIONS

Graphs are used to represent, find, analyze and optimize the connection between elements(houses, users, articles, etc.)


 There are two main elements in a graph's nodes and edges.

                                                                  Fig:-1   Graph
  • Nodes:- they are the elements that create the network. Anything that you could represent as being connected to other similar elements in the network.
  • Edges:- they are connections between the nodes. They could represent streets, a connection between two users in a social network.
       If there is no connection:-  If two nodes are not connected by an edge, that means there is no direct connection between them.

You might still be able to go from one node to another by following a sequence of edges, similar to driving through several streets to reach your final destination.

For example in the diagram below, even though there is no direct connection(edge) between the purple node (left) and yellow node (right), you can go from the purple node to orange node, to the Pink node, to the green node and finally reach the yellow node.

                         Fig:-2 No direct connection between the purple and yellow node


      💥 NOTATION AND TERMINOLOGY:

           It's very important to learn the formal language to work with graphs.

  •             |V| = Total number of vertices (nodes) in the graph.
  •           |E| = Total number of connections (edges) in the graph.

                                       🍁🍁 TYPES OF GRAPHS 🍁🍁


  1. Directed Graphs
 In a directed graph, edges have a direction. They go from one node to another, and there is no way to return to the initial node through that edge.
In a directed graph, you may not be able to return at all to your initial location if there is no path with the appropriate directions.



                                                   Fig:-3 Directed Graph

  2. Undirected Graphs

     In this type of graph, edges are undirected( they do not have a specific direction). Think of undirected edges as two-way streets. You can go from one node to another and return through the same path.


                                                      Fig:- 4 Undirected Graph

Whenever you see a diagram of a graph where the edges don't have arrows pointing in a specific direction, you can assume that the graph is undirected. 



                

              





Comments

Popular posts from this blog

Rising of the AI in the human centric Development

Rising of the AI in the human centric Development The rising of the artificial intelligence in later 90's have make a rapid impact in field of technology and from 21st century the blooming of a mechanism makes several impact in various industries including software, education, healthcare and many more. As the world becomes increasingly reliant on technology, the role of  artificial intelligence  (AI) in human-centric development has risen to the forefront. From healthcare to transportation to education, AI is being used to improve the lives of people around the globe. Major areas where artificial intelligence AI makes an Impact One area where AI has made significant strides is in the healthcare industry. AI-powered virtual assistants can now assist doctors in diagnosing and treating patients, freeing up valuable time for medical professionals. In addition, AI-powered wearable devices can track a person's health and alert them to any potential issues. The transportation industr...

The Magic of Data Visualization using Matplotlib

      The Magic of Data Visualization Using Matplotlib Matplotlib is a multiplatform data visualization library built on Numpy arrays and designed to work with broader Scipy Stack. Matplotlib was developed by John Hunter in 2003 with version 0.1. This project is supported by Space Telescopic institute for complete development and extension for better capabilities. Matplotlib library enhances the plotting and visualization technique in python. As using the matplotlib we can create various plots, histogram, maps, chart and many more plotting. Visualization of Data     Important features of Matplotlib   It play and operates well with many operating systems and graphics back-ends.   Matplotlib have strength of running cross platform graphics engine smoothly and reliable to different types of graphics system.   There are various API’s and wrappers make this library to useful to dive into Matplotlib’s syntax to adjust the final plot output. Customizatio...

Components of Data Science Life Cycle

                                            Components of Data Science Life Cycle Data Science continues to evolve as the one of the most promising and demanding career of 21st century. The insights drawn from the data is very much useful and profitable for the businesses when processed with intelligent algorithms to find pattern and insights from it. The complete Data science follows a life cycle pattern which defines the steps of each stage of data and apply them to make it processed in more informative and easier way. The components of Data Science life cycle consist of five stages. Each stage have different tasks which perform on data during complete life-cycle span of Data science.                                                        ...