The document discusses graphs and graph theory. It defines graphs as non-linear data structures used to model networks and relationships. The key types of graphs are undirected graphs, where edges have no orientation, and directed graphs, where edges have orientation. Graph traversal algorithms like depth-first search and breadth-first search are discussed. Common graph terminology is defined, including vertices, edges, paths, cycles, degrees. Different graph representations like adjacency matrices and adjacency lists are also covered. Applications of graphs include modeling networks, routes, and relationships.
Directed Acyclic Graph Representation of basic blocks is the most important topic of compiler design.This will help for student studying in master degree in computer science.
Directed Acyclic Graph Representation of basic blocks is the most important topic of compiler design.This will help for student studying in master degree in computer science.
this presentation is made for the students who finds data structures a complex subject
this will help students to grab the various topics of data structures with simple presentation techniques
best regards
BCA group
(pooja,shaifali,richa,trishla,rani,pallavi,shivani)
this presentation is made for the students who finds data structures a complex subject
this will help students to grab the various topics of data structures with simple presentation techniques
best regards
BCA group
(pooja,shaifali,richa,trishla,rani,pallavi,shivani)
Graphs are propular to visualize a problem . Matrix representation is use to convert the graph in a form that used by the computer . This will help to get the efficent solution also provide a lots of mathematical equation .
A graph G consists of a non empty set V called the set of nodes (points, vertices) of the graph, a set E, which is the set of edges of the graph and a mapping from the set of edges E to a pair of elements of V.
Any two nodes, which are connected by an edge in a graph are called "adjacent nodes".
In a graph G(V,E) an edge which is directed from one node to another is called a "directed edge", while an edge which has no specific direction is called an "undirected edge". A graph in which every edge is directed is called a "directed graph" or a "digraph". A graph in which every edge is undirected is called an "undirected graph".
If some of edges are directed and some are undirected in a graph then the graph is called a "mixed graph".
Any graph which contains some parallel edges is called a "multigraph".
If there is no more than one edge but a pair of nodes then, such a graph is called "simple graph."
A graph in which weights are assigned to every edge is called a "weighted graph".
In a graph, a node which is not adjacent to any other node is called "isolated node".
A graph containing only isolated nodes is called a "null graph". In a directed graph for any node v the number of edges which have v as initial node is called the "outdegree" of the node v. The number of edges to have v as their terminal node is called the "Indegree" of v and Sum of outdegree and indegree of a node v is called its total degree.
Vaccine management system project report documentation..pdfKamal Acharya
The Division of Vaccine and Immunization is facing increasing difficulty monitoring vaccines and other commodities distribution once they have been distributed from the national stores. With the introduction of new vaccines, more challenges have been anticipated with this additions posing serious threat to the already over strained vaccine supply chain system in Kenya.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
Maintaining high-quality standards in the production of TMT bars is crucial for ensuring structural integrity in construction. Addressing common defects through careful monitoring, standardized processes, and advanced technology can significantly improve the quality of TMT bars. Continuous training and adherence to quality control measures will also play a pivotal role in minimizing these defects.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Event Management System Vb Net Project Report.pdfKamal Acharya
In present era, the scopes of information technology growing with a very fast .We do not see any are untouched from this industry. The scope of information technology has become wider includes: Business and industry. Household Business, Communication, Education, Entertainment, Science, Medicine, Engineering, Distance Learning, Weather Forecasting. Carrier Searching and so on.
My project named “Event Management System” is software that store and maintained all events coordinated in college. It also helpful to print related reports. My project will help to record the events coordinated by faculties with their Name, Event subject, date & details in an efficient & effective ways.
In my system we have to make a system by which a user can record all events coordinated by a particular faculty. In our proposed system some more featured are added which differs it from the existing system such as security.
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSEDuvanRamosGarzon1
AIRCRAFT GENERAL
The Single Aisle is the most advanced family aircraft in service today, with fly-by-wire flight controls.
The A318, A319, A320 and A321 are twin-engine subsonic medium range aircraft.
The family offers a choice of engines
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
3. Introduction to graph
Non-linear data structure used in
solving games and puzzles
No root node as in trees
Complex Data structure
Graph Theory : study of graphs in CS
4. Contd.,
• Graphs are used to represent network
structures
Computer network Route map of Coimbatore
• Graphs unlike trees, do not represent
hierarchical relationship
5. Applications of graph
Analysis of electrical circuits
Finding shortest routes
Project Planning
Social sciences
Cybernetics
Linguistics ………..
6. What is a graph?
A data structure that consists of a set of
nodes (vertices) and a set of edges that
relate the nodes to each other
The set of edges describes relationships
among the vertices
7. Formal definition of graphs
A graph G is defined as follows:
G=(V,E)
V(G): a finite, nonempty set of
vertices
E(G): a set of edges (pairs of
vertices)
Where,
V = { v1,v2,v3,…vn}
E = {e1,e2,e3,…en}
11. 11 Lecture 7: Graphs
Directed Graphs
A directed graph is a graph which
consists of directed edges, where
each edge in E is unidirectional.
Also referred as digraph.
Each edge connects two vertices,
called the source and target
If (v,u) is a directed edge, then (v,u)
(u,v)
12. 12 Lecture 7: Graphs
Directed Graphs
A directed graph is a finite set of
vertices and a finite set of edges.
Each edge connects two vertices,
called the source and target; the edge
connects the source to the target
(order is significant)
13. 13 Lecture 7: Graphs
Directed Graphs
V1
V3
V2
Useful for modelling directional
phenomena, like geographical
travel, or game-playing where
moves are irreversible
Examples: modelling states in a
chess game, or Tic-Tac-Toe
Arrows are used to represent
the edges; arrows start at the
source vertex and point to the
target vertex
(V1,V2) (V2,V1)
15. Undirected Graphs
An undirected graph is a graph, which
consists of undirected edges.
If (v,u) is an undirected edge then
(v,u)=(u,v)
Each edge connects two vertices
The order of the connection is
unimportant
V1 V2
V3
(V1,V2) = (V2,V1)
16. L23 16
Simple Graphs
Different purposes require different types
of graphs.
Eg: Suppose a local computer network
◦ Is bidirectional (undirected)
◦ Has no loops (no “self-communication”)
◦ Has unique connections between computers
17. L23 17
Multigraphs
If computers are connected via
internet, there may be several routes
to choose from each connection.
Depending on traffic, one route could
be better than another.
It allows multiple edges, but still no
self-loops
18. 0 2
1
(a)
2
1
0
3
(b)
Example of a graph with feedback loops and a multigraph
self edge multigraph:
multiple occurrences
of the same edge
20. Adjacent nodes and path
Two nodes are adjacent if they are connected
by an edge
A path in a graph is a sequence of vertices,
each adjacent to the next
A D
EB
FC
adjacent (A) ={B,C,D}
adjacent (B) ={A,C,E}
adjacent (C) ={A,B,D,E}
adjacent (D) ={A,C,E,F}
adjacent (E) ={B,C,D,F}
adjacent (F) ={E,D}
Path 1: A -> B -> E -> F
Path 2: A -> C -> E -> F
Path 3: A -> D -> F
Path 4: A -> C -> D -> F
21. Length of the path and Cycle
Length of the path is the number of edges
on the path, which is equal to N-1, where N
is the number of vertices.
Cycle in a graph is a path in which first and
last vertices are the same.
V1 V2 V3 V1
A graph which has cycles is referred to as
cyclic graph
V3 V2
V1 Length of the path V1 to V2
is 2.
ie., (V1,V2), (V2,V3)
22. Degree
The number of edges incident on a
vertex V determines its degree.
In undirected graph, degree(V) = number
of edges incident at V.
In directed graph, it is categorized into
indegree and outdegree.
Indegree (V) = no. of edges entering into
the vertex V
outdegree (V) = no. of edges exiting from
the vertex V
23. Contd.,
Vertex Degree
A
B
C
D
3
2
2
3
A B
C D
Table 1:Degree of each vertex of an undirected graph
A
DC
B Vertex Indegree Outdegree
A
B
C
D
2
1
2
1
1
2
1
2
Table 2: indegree and outdegree of each vertex of directed graph
24. Acyclic graph
A directed graph which has no cycle is
referred to as acyclic graph.
It is abbreviated as DAG (Directed
Acyclic Graph)
A
B C
D
E
25. Weighted Graph
A graph is said to be weighted graph if every edge
in the graph is assigned some weight or value.
The weight of the edge is a positive value the may
be representing the cost or distance between the
vertices.
For example, in a road map represented as a
graph, weight of the edges can be based on the
distance between the cities or functions of distance
and traffic in the road
26. Complete and Incomplete Graph
0
1 2
3
0
1 2
3 4 5 6
G1
G2
V(G1)={0,1,2,3} E(G1)={(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)}
V(G2)={0,1,2,3,4,5,6} E(G2)={(0,1),(0,2),(1,3),(1,4),(2,5),(2,6)}
complete graph incomplete graph
A complete graph is a graph in which every vertex is
directly connected to every other vertex
27. What is the number of edges in a
complete directed graph with N
vertices?
N * (N-1)
Here in this example,
N = 4
No. of edges = 4 * 3
= 12
Contd..
28. What is the number of edges in a complete
undirected graph with N vertices?
N * (N-1) / 2
Here in this example,
N = 5
No. of edges = 5 * 4 / 2
= 10
Contd.,
29. Subgraph
A subgraph of G is a graph G’ such
that V(G’) is a subset of V(G) and E(G’)
is a subset of E(G)
30. 0 0
1 2 3
1 2 0
1 2
3
(i) (ii) (iii) (iv)
(a) Some of the subgraph of G1
0 0
1
0
1
2
0
1
2
(i) (ii) (iii) (iv)
(b) Some of the subgraph of G2
0
1 2
3
G1
0
1
2
G2
Subgraphs of G1 and G2
31. Connected Graph
A graph is called connected if there is
a path from any vertex to any other
vertex.
A B
C D
Connected Graph
A
C D
B
Unconnected Graph
32. Graph representation
A graph is a mathematical structure
and it must be represented in some
kind of data structure.
Two ways to represent the graph:
Adjacency matrix
Adjacency list
33. Array representation
Simple way to represent a graph is to
use 2D array.
This is known as adjacency matrix
representation.
Adjacency matrix A for a graph G =(V,E)
with n vertices is an n x n matrix such
that,
Aij = 1, if there is an edge Vi to Vj
Aij = 0, if there is no edge
35. Contd.,
Adjacency matrix for weighted graph
Aij = Cij if there exists an edge from Vi to Vj
Aij = 0 if there is no edge and i = j
If there is no edge for i to j, assume C[i,j] =
V1
V4V3
V2
V1 V2 V3 V4
V1 0 3 9
V2 0 7
V3 1 0
V4 1 8 0
3
7
8
9 1
36. Adjacency list representation
In this representation, graph is stored
as linked structure.
Linked list representation of undirected graph:
A
DC
B
A
B
C
D
B
A
C
A
C Null
C
B
B Null
D Null
D Null
37. Contd.,
Linked list representation of directed graph:
A
DC
B
A
B
C
D
B
D Null
C Null
A Null
D Null
38. Topological Sort
A topological sort is a linear ordering of vertices in a
directed acyclic graph such that if there is a path from
Vi to Vj, then Vj appears after Vi in the linear ordering.
For example, a directed edge between (C1,C2)
indicates that C1 must be completed before
attempting to course C2.
10th
Arts
Eng
g
Med
PG
12th
Dip
39. Topological Order Algorithm
Algorithm Topological order (Graph G)
1. Find any vertex with no incoming
edges.
2. If such vertex is found, remove it
along with its edges from the graph.
3. Repeat step 1 for all the vertices.
END Topological order;
40. Implementing topological sort
1. Find the indegree for every vertex.
2. Enqueue the vertices whose indegree is ‘0’ on
the empty queue.
3. Dequeue the vertex V and decrement the
indegree’s of all its adjacent vertices.
4. Enqueue the vertex on the queue, if the indegree
falls to ‘0’.
5. Repeat from step 3 until the queue becomes
empty.
6. The topological ordering is the order in which the
vertices are dequeued.
41. Example
a b c d
a 0 1 1 0
b 0 0 1 1
c 0 0 0 1
d 0 0 0 0
a
cb
d
Adjacency matrix
The figure states that a precedes b, c; b precedes c, d and so on.
Step 1: Number of 1’s present in each column of adjacency matrix
represents the indegree of the corresponding vertex.
(ie.,) indegree(a) = 0 indegree(b) = 1
indegree(c) = 2 indegree(d) = 2
Step 2: Enqueue the vertex whose indegree is ‘0’.
vertex a is ‘0’, so place it on the queue.
42. Graph implementation
Array-based implementation
◦ A 1D array is used to represent the vertices
◦ A 2D array (adjacency matrix) is used to
represent the edges
44. Graph implementation (cont.)
Linked-list implementation
◦ A 1D array is used to represent the vertices
◦ A list is used for each vertex v which contains
the vertices which are adjacent from v
(adjacency list)