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

Machine Learning and It's Types

                           Machine Learning and It's Types                                 Machine Learning is ability to automatically learn and improve from experience without being explicitly programmed. So rather than typing the code for all the times and do knowledge engineering, machine learning helps the machine  to learn from previous data and find insights and pattern from it.  Basically Data is train on given data set and and applied machine learning algorithm and it find insights. Simply put, Machine learning makes a computer act and think like a human. Types of machine learning           Supervised Learning In supervised learning you use labeled data,which is a data set that has been classified, to infer a learning algorithm. The data set is used as the basis for predicting the classification of other unlabeled data through the use of machine learning algorithms. Supervised and Unsupervised learning   Uns

When to Use HeatMap plot for Visualization of Data

HeatMap (Matrix) Plot Visualization for the Data: When to Use? Visual representation always helps in simplification either any real world entities or the data. Visualization  provides an pictorial representation so anyone can easily understand about the data and their insights(what they are representing and in which range the value is lying.                                                                                                                                                             Source: HeatMap Now when the data science becomes one of the popular domain in Computer science. It makes a big impact both in technology domain and in industries. Every industries now a days wants to find insights about their business data that are generated daily and improve and grow their business accordingly. So the data science jobs now become very trending. To make a complete analysis of data one's should many times go through visualization phase. Because everyone is not a good statist

Artificial Intelligence Transforms the World by Automating the Industries

              Artificial intelligence transforming the world slowly. The self-driving car, Amazon Alexa, IBM Watson, Google voice assistant all these are the few major examples of AI-powered system. The current impact of artificial intelligence makes it's a major field of study for computer science students regarding the future because there is a huge demand for machine learning and Artificial intelligence engineers and researchers in industry. By making everything automatic(self-learning technique) through computation it changes the world slowly. The current scenario of artificial intelligence is highly trending and many of the top multi-national companies acquire this technology to improve their business as well as more production. The one of core part of AI i.e. machine learning which is also also playing a majore role in this growth. . https://www.searchenterpriseai.techtarget.com After seeing the huge demands of machine learning and Artificial Intellig