Graph

Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

Graph

kashiram pokharel
kashiram pokharel
Introduction

• Graph is a non linear data structure..


• A graph G is a collection of two sets V and E.
where V is the collection of vertices V1, V2, V3,….Vn and E is the
collection of edges E1, E2, E3…..En where edge is the line
connecting two vertices.
Hence a graph G can be represented as
• G=(V,E)
Where,
V=( V1,V2,V3,….Vn) or set of vertices
E=( e1,e2,e3…..en) or set of edges

kashiram pokharel
Uses of graph

• To design airline route map:


• Vertices are cities
• A line connects two cities if and only if there is a non-stop flight between them in
between direction.
• To design electrical circuit:
• Vertices could be diodes, transistor, capacitor and so on
• Two vertices are connected by a line if there is a wire connecting them.
• To design a flowchart.
• In computer networks
• Computers, routers are vertices
• The connecting cables behave like edges.
• Solving puzzles and games
• In network broadcast(eg. In router for routing data)
• Find shortest path between cities in pokharel
kashiram transportation.
Type of graph:
• In terms of connection
• Connected graph
• Not connected graph
• In terms of direction
• Directed graph
• Undirected graph
• Simple graph
• Multi graph
• Pseudo graph
• In terms of strength of connection
• Strongly connected
• Weakly connected
• In terms of weight
• Weighted graph
• Unweighted graph kashiram pokharel
Connected graph:

• A graph is connected when there is a path between every pair of


vertices. In a connected graph, there are no unreachable vertices.
• A graph is said to be connected if its every nodes are reachable.

kashiram pokharel
Not connected graph:

• A graph in which at least one node is not connected or all nodes may
not be connected is called not-connected graph.

kashiram pokharel
Undirected graph:

• A graph which has unordered pair of vertices is called undirected graph.


suppose there is an edge between vertex A and B then it can be represented
as (A,B)or (B,A).
• The edges of a graph are assumed to be unordered pairs of nodes.
Sometimes we say undirected graph to emphasize this point.
• In an undirected graph, we write edges using curly
braces to denote unordered pairs.

• For example, an undirected edge { A,B } from vertex A to vertex B is the


same thing as an undirected edge { B,A } from vertex B to vertex A.
kashiram pokharel
Directed graph:

• A directed graph or digraph is a graph which has directed pair of


vertices. suppose there is an directed edge between vertex A and B
then it can be represented as (A,B).Here A is the tail and B is the head
of the edge.

kashiram pokharel
Simple graph:

• A simple graph, also called a strict graph is an un-weighted,


undirected graph not containing graph loops or multiple edges
A simple graph may be either connected or disconnected.
• SIMPLE graph G is one satisfying that;
• having at most one edge (line) between any two vertices (points) and,
• Not having an edge coming back to the original vertex.

kashiram pokharel
Multi graph

• A multigraph can have multiple edges (two or more edges connecting


the same pair of vertices).
• a multigraph (in contrast to a simple graph) is a graph which is
permitted to have multiple edges (also called parallel edges), that is,
edges that have the same end nodes. Thus two vertices may be
connected by more than one edge.

kashiram pokharel
Pseudo graph:

• A pseudo graph is a non-simple graph in which both graph loops and


multiple edges are permitted

kashiram pokharel
Strongly connected graph
• Connectivity in an undirected graph means that every vertex can reach
every other vertex via any path. If the graph is not connected the graph can
be broken down into Connected Components.
• Strong Connectivity applies only to directed graphs. A directed graph is
strongly connected if there is a directed path from any vertex to every
other vertex. This is same as connectivity in an undirected graph, the only
difference being strong connectivity applies to directed graphs and there
should be directed paths instead of just paths.
• Similar to connected components,
a directed graph can be broken down
into Strongly Connected Components.

kashiram pokharel
Weakly connected graph
• A digraph is strongly connected if every vertex is reachable from every
other following the directions of the arcs. I.e., for every pair of
distinct vertices uu and vv there exists a directed path from uu to vv.

• A digraph is weakly connected if when considering it as an undirected


graph it is connected. I.e., for every pair of distinct vertices uu and vv
there exists an undirected path (potentially running opposite the
direction on an edge) from uu to vv.

kashiram pokharel
Weighted graph:

• A weighted graph is a graph in which each branch is given a numerical


weight. A weighted graph is therefore a special type of labeled graph in
which the labels are numbers (which are usually taken to be positive).

kashiram pokharel
Unweighted graph:

• A unweighted graph is a graph in which edge doesn’t contain any


weight of it’s own .it just represent the connectivity between the
vertex.

kashiram pokharel
Complete graph (Kn ):
• A simple graph is said to be complete if every vertex in G is connected with
every other vertex .In other words, we can say a complete graph contains
exactly one edge between each pair of distinct vertices.
𝑛(𝑛−1)
• A complete graph is denoted by Kn . Kn has exactly edges
2

kashiram pokharel
Bipartite graph :
• A graph G is said to be bi-partite graph if it’s vertices are divided into
two subset M and N .such that
• vertices of M subset are connected to the vertices of N subset, but
• the vertices of same parts are never connected.
• If the vertices of first part are connected to all the vertices of another
subset (second part) then Bipartite graph is called complete bi-partite
graph and is denoted by Km,n where m is the number of vertices in M
subset and n is the number of vertices in N subset.
• For standardization, we will assume m<=n

kashiram pokharel
• The graph Km,n has m*n edge
• How many edge have each of the following
graph?
• K3,3
• Since , K3,3 is complete bipartite graph
therefore, the number of edge =3*3=9

fig. K3,3 bipartite graph

kashiram pokharel
Properties of bi-partite graph:

• Every tree (or graph) is a bi-partite graph.


• A graph G is bipartite if and only if it contains odd cycle i.e all closed walks in
graph G are of even length
• A connected bipartite graph has a unique bipartition.
• A bipartite graph with no isolated node and p connected component has 2p-1
bi partitions
• A connected graph is bipartite if and only if for every node V there is no
edge(x,y) such that
• dist(v,x)=dist(v,y)
kashiram pokharel
Planner graph
• A graph is said to be planner graph if it can be drawn in the plane without
crossing or intersection of it’s edge .A non planner graph is one which
cannot be drawn in the plane without edge intersection
• A graph may be planner ever if it is usually drawn with crossing, because it
may be possible to
draw it in a different
way without crossing.

kashiram pokharel
Euler theorem for planner graph
• Let V be the number of vertices and E be the number of edges and f
be the number of faces .Then Euler formula is defined as:
V-E+F=2

kashiram pokharel
Corollary 1:

• If G is a connected planar simple graph with e edges and v vertices,


where v  3, then e  3v - 6.
• Check K5 planar?
K5 has 5 vertices and 10 edges.
We see that v  3.
So, if K5 is planar, it must be true that e  3v – 6.
3v – 6 = 3*5 – 6 = 15 – 6 = 9. which is false because e must be  9.
But e = 10.
So, K5 is nonplanar.
kashiram pokharel
Corollary 2:
• If G is a connected planar simple graph, then G has a vertex of
degree not exceeding 5.

kashiram pokharel
Corollary 3:
• If a connected planar simple graph has e edges and v vertices with v 
3 and no circuits of length 3, then e  2v - 4.
• Is K3,3 planar?
K3,3 has 6 vertices and 9 edges.
Obviously, v  3 and there are no circuits of length 3.
If K3,3 were planar, then e  2v – 4 would have to be true.
e 2v – 4
9 = 2*6 – 4
9 8 .which is false because e must be  8.
But e = 9.
So K3,3 is nonplanar

kashiram pokharel
Cycle graph(Cn)
• In graph theory, a cycle graph or circular graph is a graph that consists of a
single cycle, or in other words, some number of vertices connected in a
closed chain.
• The cycle graph with n vertices is called Cn. The number of vertices
in Cn equals the number of edges, and every vertex has degree 2; that is,
every vertex has exactly two edges incident with it.

kashiram pokharel
Wheel graph (Wn)
• A wheel graph is a graph formed by connecting a single vertex to all
vertices of a cycle. A wheel graph with n vertices can also be defined
as the 1-skeleton of an (n-1)-gonal pyramid.
• A wheel graph is obtained from a cycle graph Cn-1 by adding a new
vertex. That new vertex is called a Hub which is connected to all the
vertices of Cn.
• No. of edges in Wn = No. of edges from hub to all other vertices +
No. of edges from all other nodes in cycle graph without a hub.
= (n–1) + (n–1)
= 2(n–1)
kashiram pokharel
Degree of a graph
• In an undirected graph, the number of edges connected to a node is
called the degree of that node. i.e. degree of a node is the number of
edges incident on it.
• The total number of edges incident on a particular vertex is called it’s
degree. let v be the vertex of a graph ,then it’s degree is denoted by
deg(v).
• In case of directed graph, degree is the sum of in-degree and out-
degree.
• A loop at a vertex contributes twice to the degree of that vertex

kashiram pokharel
c d
b

a g f e

• deg(a) = 2, deg(b) = 6, deg(c) = 4, deg(d) = 1,


• deg(e) = 0, deg(f) = 3, deg(g) = 4

kashiram pokharel
In case of Directed Graph:
• In-degree:
• The in-degree of a node is the number of edges incoming to that node or The
number of vertices adjacent to v.
• Denoted by deg(v).
• Out-degree:
• The out-degree of a node is the number of edges going outside from the
node. Or The number of vertices adjacent from v
• Denoted by deg+(v)
• Note:
• A loop at a vertex contributes 1 to both the in-degree and out-degree.

kashiram pokharel
Theorem 1: (handshaking theorem)

kashiram pokharel
• deg(a)= deg(f)= deg(e)= deg(d)=2
• deg(b)= deg(c)=3
• L.H.S
• 2e=2*7=14
• R.H.S.

 degv 
vV

• =2+2+2+2+3+3
• =14
• Therefore,
• LHS=RHS

kashiram pokharel
Regular graph:
• A graph G is called regular graph if it’s all vertices are of the same
degree or valency. i.e. a regular graph is a graph where each vertex
has the same number of neighbors
• A regular directed graph must also satisfy the stronger condition that
the indegree and outdegree of each vertex are equal to each other.
• If the degree of each vertex is k then graph is called k-regular graph or
regular graph of degree k.
• All complete graph are regular graph but all regular graph are not
complete graph.

kashiram pokharel
Some terms about the regular graph:
• All the vertices have the same degree k.
• Every null graph is a regular graph of degree zero.
• A regular graph of degree 1 has one line
• If G is a two –regular graph. Then graph has a cycle.
• If G is a graph of degree 3 ,it is called a cubic graph.

kashiram pokharel
Shortest path algorithm:
• This algorithm is used to solve the single source shortest path problem on a
weighted directed graph
• All the edge weights must be non-negative.
• compute the length of shortest path from a source to all other remaining
vertices.
• each node is labeled with dist predecessor and status.
• dist of node represents the shortest dist of that node from the source
node and
• predecessor of a node represents the node which precedes the given node
in shortest path from source.
• Status of a node can be permanently visited or not.
kashiram pokharel
Procedure:
• Initially make source node as the current working node. All other
node are made unvisited node.
• Label a source node with 0 and all others with 
• Examine all the temporary neighbors of the current working nodes
and after checking the condition for minimum weight re-label the
required node.
• From all the temporary nodes find out the node which has minimum
value of dist , make the node permanent and now this is the current
working node.
• Repeat step 2 and 3 until destination node is made permanent.

kashiram pokharel
• set it to zero for our initial node and to infinity for all other nodes.
• Set the initial node as current. Mark all other nodes unvisited. Create a set of all the
unvisited nodes called the unvisited set.
• For the current node, consider all of its unvisited neighbors and calculate
their tentative dist from current node and If that node was previously marked with a
dist greater than current dist then relabel it with current value. Otherwise, keep the
previous value.
To update labels:
Lk(a, v) = min{Lk-1(a, v), Lk-1(a, u) + w(u, v)}
• When we are done considering all of the neighbors of the current node, mark the
current node as visited and remove it from the unvisited set. A visited node will never
be checked again.
• When unvisited set is empty then algorithm is stop and The algorithm has finished.
• Otherwise, select the unvisited node that is marked with the smallest tentative dist, set
it as the new "current node", and gokashiram
back to step 3.
pokharel
Find the shortest path using dijkstra algorithm:
• Let source node =A
• Destination node=F

kashiram pokharel
• Label 0 for starting vertex and other ∞

kashiram pokharel
• Check adjacent node of A and mark node A as visited node
L(A,B)=min{dist(B) ,{dist(A)+dist(A,B)}} min(∞ ,0+2) relabel B by 2
L(A,C) =min{dist(C),{ dist(A)+dist(A,C)}  min(∞ ,0+6) relabel C by 6

kashiram pokharel
• Here B is in shortest dist then, Check adjacent node of B and mark node B
as visited node
• L(A,D)=min{dist(D) ,{dist(B)+dist(B,D)}} min(∞ ,2+7) relabel D by 9
L(A,C) =min{dist(C),{ dist(B)+dist(B,C)}  min(6 ,2+3) relabel C by 5

kashiram pokharel
• Now check adjacent node of c, and mark node C as visited node
• L(A,E)=min{dist(E), (dist(C)+dist(C,E))} min(∞ ,5+9) relabel E by 14
• L(A,D)=min{dist(D), (dist(C)+dist(C,D))}min(9 ,5+2) relabel D by 7

kashiram pokharel
• Check adjacent node of D, and mark node D as visited node
• L(A,E)=min{dist(E), (dist(D)+dist(D,E))} min(14,7+6 ) relabel E by 13
• L(A,F)=min{dist(D), (dist(D)+dist(D,F))}min(∞ ,7+10 ) relabel D by 17

kashiram pokharel
• check adjacent node of E, and mark node E as visited node
• L(A,F)=min{dist(F), (dist(E)+dist(E,F))} min(17,13+5 ) relabel F by 17
• Hence final graph becomes.

kashiram pokharel
kashiram pokharel
kashiram pokharel
Transitive closure
• Transitive Closure it the reachability matrix to reach from vertex u to vertex
v of a graph
• A transitive closure matrix is a matrix formed by the reachability factor,
which means if one node A of the graph is reachable from another node B,
then there exists positive reachability between A and B
• This can be easily denoted by using binary denotation of 0 and 1
• Floyd Warshall Algorithm is used to find the shortest distances between
every pair of vertices in a given weighted edge Graph. Well, for finding
transitive closure, we don't need to worry about the weighted edges and
we only need to see if there is a path from a starting vertex i to an ending
vertex j

kashiram pokharel
Warshall algorithm:
• Warshall’s Algorithm
• Main idea: a path exists between two vertices i, j, iff
• there is an edge from i to j; or
• there is a path from i to j going through vertex 1; or
• there is a path from i to j going through vertex 1 and/or 2; or
• there is a path from i to j going through vertex 1, 2, and/or 3; or
..
• there is a path from i to j going through any of the other vertices

kashiram pokharel
kashiram pokharel
kashiram pokharel
kashiram pokharel
kashiram pokharel
Graph traversal:
• Graph traversal is a technique used for searching a vertex in a graph.
The graph traversal is also used to decide the order of vertices is
visited in the search process. A graph traversal finds the edges to be
used in the search process without creating loops. That means using
graph traversal we visit all the vertices of the graph without getting
into looping path.
• Type of search algorithm:

kashiram pokharel
Breadth First Search(BFS)

• Breadth-first search is the most common search strategy for traversing a tree or
graph. This algorithm searches breadthwise in a tree or graph, so it is called
breadth-first search.
• BFS algorithm starts searching from the root node of the tree and expands all
successor node at the current level before moving to nodes of next level.
• BFS traversal of a graph produces a spanning tree as final result. Spanning Tree
is a graph without loops. We use Queue data structure with maximum size of
total number of vertices in the graph to implement BFS traversal
• In this, first we take any node as a starting node then we take all the nodes
adjacent to that starting node. Similar approach we take for all other adjacent
node, which are adjacent to the starting node and so on. We maintain the status
of the visited node in one array so that no node can be traversed again.

kashiram pokharel
Algorithm:

• Step 1: SET STATUS = 1 (ready state) for each node in G


• Step 2: Enque ue the starting node In a queue and set its STATUS = 2
(waiting state)
• Step 3: Repeat Steps 4 and 5 until QUEUE is empty
• Step 4: Dequeue a node N. Process it and set its STATUS = 3 (processed
state).
• Step 5: Enqueue all the neighbours of N that are in the ready state (whose
STATUS = 1) and set their STATUS = 2 (waiting state)
[END OF LOOP]
• When queue becomes empty, then produce final spanning tree by
removing unused edges from the graph
• Step 6: EXIT

kashiram pokharel
kashiram pokharel
kashiram pokharel
kashiram pokharel
Example2:

kashiram pokharel
kashiram pokharel
DFS(Depth First Search)
• DFS traversal of a graph produces a spanning tree as final
result. Spanning Tree is a graph without loops. We use Stack data
structure with maximum size of total number of vertices in the graph to
implement DFS traversal

kashiram pokharel
kashiram pokharel
Spanning tree:

kashiram pokharel
kashiram pokharel
kashiram pokharel
• Algorithm for generating minimum spanning tree are :
• Prism algorithm
• Kruskals algorithm
• Round robin algorithm

kashiram pokharel
Prism algorithm:

• we start with an arbitrary vertex of given graph. Let the arbitrary vertex be
V .Then we find all the adjacent vertices of V and make a set of consisting
of these vertex pair.
• we select the vertex pair with the least weight from this set and add the
vertex pair to the tree to be formed. Let this vertex pair be (u,w).
• Again we find all the adjacent pair of w and add these vertex pair to the
previous set such that a new set of pair of vertices is formed.
• Then we select a vertex pair with least weight from this newly formed set
and add it to the tree to be formed .while adding vertex pair to the tree, if
any vertex pair with minimum weight forms a cycle, we discard it and move
to the vertex pair with next minimum weight in the set.

kashiram pokharel
Find the minimum spanning tree from the
following graph.
Step 1:
• Let the arbitrary vertex be V1
• The adjacent vertex of V1 are v2,v3,v4 and v5
• Hence the set of these pair of vertices is
• (v1,v2)=5
• (v1,v3)=4
• (v1,v4)=9
• (v1,v5)=6
• Since the vertex pair (v1,v3)=4 is the vertex pair with least weight, it is
added to the tree and removed it from the set.
kashiram pokharel
Step 2:
• Now adjacent node of v3 are v1,v2,v5.Therefore, add these adjacent pair into the set
,Then the set becomes,
• (v1,v2)=5
• (v1,v4)=9
• (v1,v5)=6
• (v3,v2)=8
• (v3,v5)=12
• Since the vertex pair (v1,v2)=5 is the vertex pair with least weight, it is added to the tree
and removed it from the set.
Step 3:
• Now the adjacent node of v2 are all included in the set. Hence , choose another
minimum value from the set. Here (v1,v5)=6 is the minimum .so , (v1,v5)=6 is included in
the tree and removed from set.
• Then set becomes
• (v1,v4)=9
• (v3,v2)=8
• (v3,v5)=12 kashiram pokharel
• Step 4:
• Again the adjacent node of v5 are v3,v1,v4,v6.hence the set consisting of these adjacent
pair is
• (v1,v4)=9
• (v3,v2)=8
• (v3,v5)=12
• (v5,v4)=10
• (v5,v6)=15
• Here the adjacent pair (v3,v2)=8 is minimum but it forms the cycle.Hence discard it.
• Again the minimum weight of vertex pair is (v1,v4)=9 .which doesn,t form any cycle.Hence
it is added to the tree.
• Now the tree becomes

kashiram pokharel
• Now adjacent node of v4 are v6,v5,v1 and (v1,v4)is already in set hence
discard it. Therefore new set is
• (v3,v5)=12
• (v5,v4)=10
• (v5,v6)=15
• (v4,v6)=20
• Here ,minimum weight of vertex pair is (v5,v4)=10 which forms a cycle and
hence discard it.
• Again , minimum weight of a set is (v3,v5)=12 which agains forms a cycle
and hence discard it.
• Again minimum weight of vertex pair in a set is (v5,v6)=15 .so include this
vertex pair in a tree.
kashiram pokharel
• The adjacent node of v6 are v4 and v5 which are already in tree so
discard them.
• Now choose minimum weighted vertex pair in a set i.e. (v4,v6)=20
which also forms a cycle hence discard it.
• Now the final minimum spanning tree is

kashiram pokharel
Kruskals algorithm:
• In kruskals algorithm, we first list all the pair of vertices in ascending order
of their weights. i.e. The vertex pair with least weight is the first pair of the
list, the vertex pair with the next minimum weight is the second pair of the
list and so on.
• Then we take the vertex pair with the least minimum weight from this list
and add it to the tree to be formed .During the process of adding vertex
pair to the tree, if any vertex pair with minimum weight forms a cycle, we
discard it and moves to the vertex pair with minimum weight in the list.
• This process is continued until all the vertex pairs from the list are added to
the tree. when the list becomes empty,the resulting tree will be the
minimum spanning tree.
kashiram pokharel
Find the minimum spanning tree from the
following graph:

kashiram pokharel
• Solution:
• The list of vertex pairs in ascending order of their weight
• (V2,V3)=5
• (V1,V3)=6
• (V1,V2)=8
• (V1,V4)=10
• (V5,V7)=10
• (V4,V3)=12
• (V3,V6)=15
• (V4,V6)=20
• (V4,V5)=22
• (V5,V6)=25
• (V6,V7)=30

• Since ,the vertex pair (V2,V3)=5 is the pair with least weight .so it is added to the tree.

kashiram pokharel
• Step 2:
• The vertex pair in ascending order (V1,V3)=6 is minimum weight ,so it is
added to the tree
Step 3:
• The least weighted vertex pair in the list is (V1,V2)=8 but it generates
cycle.so discard it .
• Again ,the least weight vertex pair in the list is (V1,V4)=10 .so it is added
to the list.

kashiram pokharel
• Step iv:
• The least weight vertex pair in the list is (V5,V7)=10 Hence it is added
to the tree now the tree becomes

• STEP V:
• The next least weight vertex pair in the list is (V4,V3)=12 but which
generates the cycle in the list so discard it
• Again , the next least weight vertex pair in the list is (V3,V6)=15 hence
it is added to the tree.
kashiram pokharel
• STEP VI:
• The next least weighted vertex pair in the list is (V4,V6)=20 but which forms a
cycle hence discard it.
• Again, the next least weighted vertex pair is (V4,V5)=22. Hence it is added to
the tree.

• Step vii:
• The remaining weighted vertex pair in the list forms a cycle .Hence discard
them .
• Now the total weight of the tree is w=5+6+10+15+22+10=………..

kashiram pokharel
Round robin algorithm:
• It is an algorithm to find minimum spanning tree , provides the better performance
when the number of edge is low. It is similar to kruskals algorithm except that there
is a priority queue of arcs associated with each partial tree rather than the one
global priority queue of all unexamined arcs.
Algorithm:
• Initialize all the vertices in a priority queue
• Each vertex is in it’s own set called partial tree and maintained in a queue arbitrarily.
• Maintain each edge associated with each node or partial tree in priority queue ordered by the
weight of the edges
• Select a partial tree from queue and find the minimum weighted edge incident to
the partial tree from priority queue.
• Find the partial tree that is connected by minimum path edge .remove two sub tree
joining by the edge and combine into a single new tree and add to rear of the
queue.
• Combine two priority queue of the node A and B (partial tree A and B) and delete the edge
connecting them from queue.
• Repeat the algorithm until a queue contains a single tree which is called minimum spanning tree.
kashiram pokharel
Find the minimum spanning tree
using Round robin algorithm:
STEP 1:
• Insert all the nodes in the queue(sequentially or randomly)
• Queue: A, B, C, D, E, F
• Now A can be removed from the queue. Select a minimum weighted
edge of partial tree of A. Here, AB=2 is the shortest edge connected
with the node A. so B is also removed from the queue .Now ,AB is a
single partial tree and is inserted from rear of the queue.
• Queue: C,D,E,F,AB

kashiram pokharel
• C can be removed from queue. select a minimum weighted edge of
partial tree of C. CF=2 is the shortest edge connected with C. so F is
also removed from queue. Now CF is a single partial tree and is
inserted at the rear of the queue.
• Queue: D,E,AB,CF

kashiram pokharel
• D can be removed from queue. select a minimum weighted edge of
partial tree of D. Here, (D, AB)=1 is the shortest edge connected with
D. so AB also removed from queue. now, DAB is a single partial tree
and is inserted at the rear of the queue.
• Queue: E, CF, DAB
• Tree:

kashiram pokharel
• DAB partial can be removed
from queue, select a minimum
• Remove vertices E,CF and insert weighted edge of partial tree of
at rear of queue ECF DAB with another partial tree
.Here DAB,ECF=3 is the shortest
• Queue: DAB,ECF edge so, insert at the rear of
• Tree: queue ABDECF
• Queue: ABDEFC

Which is the required minimum spanning tree.


And
Weight=10
kashiram pokharel
Applications of MST
• Designing physical networks
• telephone, electrical, hydraulic, TV cable, computer, road
• Cluster analysis
• delete long edges leaves connected components
• analyzing fungal spore spatial patterns
• Approximate solutions to NP-hard problems(non-deterministic polynomial-time
hardness)
• metric TSP (Traveling Salesman Problem), Steiner tree
• Indirect applications.
• describing arrangements of nuclei in skin cells for cancer research
• learning salient features for real-time face verification
• modeling locality of particle interactions in turbulent fluid flow
• reducing data storage in sequencing amino acids in a protein

kashiram pokharel

You might also like