Skip to main content

Afiiliate Program

 1. Amazon Afiiliate Link  https://amzn.to/3wZR1pz  https://amzn.to/3x5KGt3 The Amazon Affiliate program, also called "Amazon Associates," can be an easy way to monetize your website or blog. Simply sign up, receive immediate approval, and place Amazon affiliate links on your site. When someone makes an Amazon purchase via one of your links, you get the commission — it's that simple. 2. Flipkart Affiliate Link https://www.flipkart.com/?affid=vatsalgup2

Graph Data Structure

 

Graph: A graph is a non-linear data structure consisting of nodes and edges.The nodes are sometimes also referred to as vertices and the edges are lines and arcs that connect any two nodes in the graph.


A graph consists of a finite set of vertices(or nodes) and a set of edges which connect a pair of nodes.


Graphs are used to solve many real-life problems. Graphs are used to represent networks. The networks may include paths in a city or telephone network or circuit network. Graphs are also used in social networks like linkedIn, Facebook.


A graph can be defined as a group of vertices and edges that are used to connect these vertices. A graph G can be defined as an ordered set of G(V,E) where V(G) represents the set of vertices and E(G) represents the set of edges which are used to connect these vertices.


Directed and Undirected Graph 


A graph can be directed or undirected.


In an undirected graph, edges are not associated with the directions with them. If an edge exists between vertex A and B then the vertices can be traversed from B to A as well as A to B.



In a directed graph, edges form an ordered pair. Edges represent a specific path from some vertex A to another vertex B. Node A is called initial Node while node B is called terminal node.



Loop


An edge that is associated with the similar endpoints can be called a Loop.


Adjacent Nodes


If two nodes U and V are connected via an edge e, then the nodes U and V are called as neighbours or adjacent nodes.


Connected Graph


A connected graph  is the one in which some path exists between every two vertices(U,V) in V. There are no isolated nodes in the connected graph.


Complete Graph


A complete graph is the one in which every node is connected with all other nodes. A complete graph contains n(n-1)/2 edges where n is the number of nodes in the graph.


Weighted Graph


In a weighted graph, each edge is assigned with some data such as length or weight. The weight of an edge e can be given as w(e) which must be a positive(+) value indicating the cost of traversing the edge.



Degree of the Node


A degree of a node is the number of edges that are connected with that node. A node with degree 0 is called an isolated node.


Comments

Popular posts from this blog

What is Algorithm

  Algorithm A finite set of instructions that specifies a sequence of operation is to be carried out in order to solve a specific problem or class of problems is called an Algorithm. An algorithm can be defined as a well-defined computational procedure that takes some values or the set of values, as an input and produces some value, or the set of values, as an output. An algorithm is thus a sequence of computational steps that transform the input into output. It describes the specific computational procedures for achieving the input-output relationship. An algorithm must have the following properties: Correctness: It should produce the output according to the requirement of the algorithm. Finiteness: Algorithm must complete after a finite number of instructions have been executed. An Absence of Ambiguity: Each step must be defined having only one interpretation. Definition of Sequence: Each step must have a unique defined preceding and succeeding step. The first step and the la...

Graph coloring

  Graph Coloring A graph G(V, E) is given and some colors are given We have to color the vertices such that no two neighbours/adjacent vertices have the same color. This can be solved using Backtracking. There are two types of problem 1.  m-colorability decision problem If a graph G(V, E) is given and some colors are also given and just we want to know whether a graph can coloured using those colors or not. This is known as the m-coloring decision problem. 2.  m-colorability optimization problem If a graph G(V, E) is given and we want to know minimum how many colors required for coloring the graph. This problem is called the m-coloring optimization problem. Chromatic Number: The smallest number of colors needed to color a graph G is called its chromatic number.