0% found this document useful (0 votes)
10 views16 pages

Algorithm Unit 2

The document discusses various types of graphs, including undirected, complete, and directed graphs, along with their properties such as cycles and unique nodes. It also covers graph traversal algorithms like Breadth-First Search (BFS) and Depth-First Search (DFS), as well as Dijkstra's algorithm for finding the shortest path. Additionally, it mentions network flow algorithms and the representation of graphs using adjacency lists and matrices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views16 pages

Algorithm Unit 2

The document discusses various types of graphs, including undirected, complete, and directed graphs, along with their properties such as cycles and unique nodes. It also covers graph traversal algorithms like Breadth-First Search (BFS) and Depth-First Search (DFS), as well as Dijkstra's algorithm for finding the shortest path. Additionally, it mentions network flow algorithms and the representation of graphs using adjacency lists and matrices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unit -

Guraph Algothms
2

ucctao gaph

E3

2. Undinecld graph E2

V3

E3

3.
Completo graph -

V3

(3)
2

12/2
E

btween Guraph ard tee


nijerence
Guaph
NOn inean NUn incan

co lecion o colection ot tree

nodes & Edlgea nooles & deaw es

uigue nodo anique node


NO (o00t )

eycle cannot b.e


cyle Can be
tomeo
foumad NOt be a cyole
Irdegree & Qutdegree

Vorlices zridegue outdegu


VI

Vy

ROp TrSentation ots Graph.


Pdjacency mat ia
2

V
-/o/

Pdjacency it
hend noces
V2 Vg NOLL

HH
V3

V5 NVLL
BFS & DFS
Broah Fst Search (BES)

BES an algorüth to oamching


tuaveriy tnee / gaph,
QuQue data Stucle
irpdemarialion lovel
BFS wisit noles
the travers al comploled
by level
al the noples
when

Fownt Rean
AB

ABC

ABC D

ABCD£

ABeDEF
Depth Funst Sean ch (Des)

ABDE E

A8DFEC
ABD

ABDE

prim 's algonithm


Romaiing: veiices DLagram
b(a, 8), f(a,5), e (a, 6) 3
(a

b(a,3) c Cb,), f(bi u)

+(Cu),d( , 6) 3

£(f, 2), d(f, 5) 3

3
ect,2) d (f, 5) a

d (f5)

kyus bal ' s algonitm

(8) b

(10)
edges Soted true.
Diaglan
bc bc, ef ab , bf, Cf )
3

af df ae cd ed
5

ef ef ab cf af
/
5

ae cd ed
6

ab ab af dt
b

Cd ed

at df, ae
bf , ct 6

cd ed

ct Cf af dt ae, 2
L b

cd ed

ae col
af, df , 6

ed
So nte.. tee
edges diagnan,
3
df ae, c e d
5 6
5

ae cd ed
6 2

(a

cd cd, ed
3

ed ed

3
Daw the adyaenoy ist. ot Guraph G
gwen asume that epnes erted
the day Flight batscen delerent liäs
wart to om t
eity a
uith
Path
munim
a to
stop&. Fund
Guven
the
that every
minummleng
1.

Path total length

ist
Adjoaney
A B NULL
DU the gnaph.
D

odyacent to A,F G.
Fand the rooles

adjacent nodos
B, C

Ge D, E

B
A
Dijkstral s algouthm

Sowue
dcglinclion

(e

8elman encd Algoruthm.

SOUne destination

(2,5) (3,2)
(3, 2) (s,5)
(:.6) (u,3)(u,6
(U2) (1,3) (,4)
(6,7) (o,1)
3

2 3 67

3 5
5
3
3 6

cotneclily
3

i)
NB

artiulatin Pont?
which
ví)

the antieulalom po nt
Masm "hipatite graph

Quue Auguens wth

Queue 2 fugument with 3

with
Queue 3 Augumont
Thia algotthn is
the tnansitie clos
diected grapb

R [o

b
alermadiatt
C

b
intormediale a,b

b C

interediak

d
d

nlomediela

Fod Fulkons0n method


Net wok Flow algerihm
ols

olb

above Path
TO tnd milmwn ot

9-0 2

ol4
ol

the Poth

5 -4 e) )-0 2

Olu
olb

palh
5-5 0
5/5

olb
3

I-’34>b
path is
Path is 6.0.) 7-0-7,
hninun
Jmin
ly
2-1-1

ull ulu

Juuso6)

backwand diedion - Sub

e/2

43/4

Minimum tlow

You might also like