Te???a%20G??f??%20Te - PowerPoint PPT Presentation

About This Presentation
Title:

Te???a%20G??f??%20Te

Description:

... Data Engineering Lab * * Data Engineering Lab (internally disjoint paths) ... – PowerPoint PPT presentation

Number of Views:108
Avg rating:3.0/5.0
Slides: 63
Provided by: Johnn270
Category:

less

Transcript and Presenter's Notes

Title: Te???a%20G??f??%20Te


1
Te???a G??f??Teµe???se??-???????µ??-?fa?µ?????e
f??a?? 4 S??desµ???t?ta
1
2
??sa????
  • ?e??t? ßa?µ?? s??desµ???t?ta? e??? ???f??
  • ?fa?µ???? se ?p??asd?p?te µ??f?? d??t?a
    (t??ep????????a??, s?????????a?? ?.a.)

???? e??a? t? ?a??te?? d??t?? ap? ?p??? a?t????
se ????
2
3
S??desµ???t?ta ????f??
  • S????? ap???pt??s?? ????f?? V? (vertex cut set,
    vertex separating set) e??? s??dedeµ???? ???f?? G
    e??a? t? s????? t?? ????f?? ?ste ? ???f?? GV? ?a
    µ?? e??a? s??dedeµ???? ?a? ?a µ?? ?p???e? ???s??
    ?p?s????? t?? V? µe t?? ?d?a ?d??t?ta
  • S??desµ???t?ta ????f?? (vertex connectivity),
    VC(G), e??a? t? e????st? kV?, ?ste ? ???f??
    G ?a e??a? s??dedeµ???? a? d?a??af??? ????te?e?
    ap? k ????f??.
  • ? G ???eta? k-s??dedeµ???? k-connected a? VC(G)k

3
4
S??desµ???t?ta ????f?? ?s??s?
???? e??a? ? t?µ? VC t?? ???f?? N5, K5, S6, W6,
C4, K4,3, ???ß??(5,3) ?
4
5
?e???? Te???µata
  • Te???µa ??a ????f? v e??? d??d??? e??a?
    ap???pt??sa a? ?a? µ???? a? d(v)gt1
  • ????sµa ???e µ? as?µa?t?? ap??? s??dedeµ????
    ???f?? ??e? t??????st?? 2 ????f?? p?? de? e??a?
    ap???pt??se?
  • Te???µa ??a ????f? v e??a? ap???pt??sa a? ?a?
    µ???? a? ?p?????? 2 ????f?? u ?a? w (u,w?v), ?ste
    ? v ?a ß??s?eta? se ???e µ???p?t? ap? t?? u p???
    t?? w

5
6
S??desµ???t?ta ??µ??
  • S????? ap???pt??s?? a?µ?? ?? edge cut set,
    edge separating set e??a? t? s????? t?? a?µ??
    ?ste ? ???f?? G-E? ?a µ?? e??a? s??dedeµ????,
    ????? ?a ?p???e? ???s?? ?p?s????? t?? ?? µe t??
    ?d?a ?d??t?ta
  • S??desµ???t?ta a?µ?? EC(G) edge connectivity
    e??? ???f?? G e??a? t? e????st? kE?, ?ste ? G
    ?a pa?aµ??e? s??dedeµ???? ?pe?ta ap? d?a??af? k-1
    a?µ??
  • ??a? ???f?? G ???eta? k-s??dedeµ???? ?? p??? t??
    a?µ?? edge k-connected a? EC(G)k

6
7
S??desµ???t?ta ??µ?? ?s??s?
???? e??a? ? t?µ? ?C t?? ???f?? N5, K5, S6, W6,
C4, K4,3, ???ß??(5,3) ?
7
8
?e???? Te???µata
  • Te???µa ??a a?µ? e e??a? ap???pt??sa a? ?a?
    µ???? a? ?p?????? 2 ????f?? u ?a? w, t?t??e? ?ste
    ? e ?a ß??s?eta? se ???e µ???p?t? ap? t?? u p???
    t?? w.
  • Te???µa ??a a?µ? e??a? ap???pt??sa a? ?a? µ????
    a? de? pe????eta? se ?????
  • Te???µa Whitney VC(G) EC(G) d(G)
  • ????sµa EC(G) floor(2m/n)
  • Te???µa ?st? 1?n-1. ?? d(G)?(n?-2)/2, t?te ?
    G e??a? ?-s??dedeµ????

8
9
?a??de??µa
VC(G)? ?C(G)?
1
2
8
3
7
4
6
5
9
10
?eµ???a G??f??
  • ??a? d?s??dedeµ????-biconnected ???f?? de? ??e?
    ap???pt??se? ????f??.
  • ??a? t?t???? ???f?? ap?te?e? ??a teµ????-block ?
    µ?a d?s???st?sa-bicomponent (biconnected
    component)
  • ?eµ???? e??? ???f?? ???eta? ??a? ?p????f?? p??
    e??a? d?s??dedeµ???? ?a? ??e? t? µ???st? a???µ?
    ????f??.
  • ??sa teµ???a ??e? ? d?p?a??? ???f???

10
11
?eµ???a G??f?? s????e?a
  • ??? teµ???a e??? ???f?? ????? t? p??? µ?a ?????
    ????f?.
  • ???e ???f?? ta?t??eta? µe t?? ???s? t?? teµa????
    t??.
  • ?a teµ???a e??? ???f?? µp????? ?a ß?e???? µe DFS
  • ?e? µp??e? µ?a ????f? ?a e??a? ????? se d??
    teµ???a e??? ???f??.
  • ?a teµ???a e??? ???f?? ???????? t?? a?µ?? se
    a?e???t?ta s????a.

11
12
?s?te???? ???a µ???p?t?a
  • ?s?te???? ???a µ???p?t?a (internally disjoint
    paths) e??a? d?? µ???p?t?a µe ?????? te?µat????
    ????f??, ????? ???e? ?????? ????f??.

2
5
7
0
1
8
9
3
4
6
12
13
Te???µa Whitney
  • Te???µa ??a? ???f?? G µe n3 e??a?
    d?-s??dedeµ???? a? ?a? µ???? a? d?? ?p??esd?p?te
    ????f?? t?? e??a? s??dedeµ??e? µe t??????st?? d??
    es?te???? ???a µ???p?t?a.
  • ????sµa ?? ??a? ???f?? G e??a? d?s??dedeµ????,
    t?te d?? ?p??esd?p?te ????f?? t?? a?????? se ??a?
    ?????.
  • ????sµa ?? ??a? ???f?? ap?te?e?ta? ap? ??a
    teµ???? µe n3, t?te d?? ?p??esd?p?te a?µ?? t??
    a?????? se ??a? ?????.

13
14
Te???µa Menger
  • Te???µa ? µ???st?? a???µ?? es?te???? ?????
    µ???pat??? ap? µ?a ????f? u se µ?a ????f? v e???
    s??dedeµ???? ???f?? ?s??ta? µe t?? e????st?
    a???µ? ????f??, p?? ???????? t?? ????f?? u ?a? v.
  • 11 d?at?p?se?? t?? Te???µat?? Menger
  • Te???µa Whitney ??a? ???f?? e??a? k-s??dedeµ????
    a? ?a? µ???? a? ??a ta ?e??? ????f?? e?????ta? µe
    t??????st?? k es?te???? ???a µ???p?t?a.

14
15
????sµata (?? p??? a?µ??)
  • ????sµa ? µ???st?? a???µ?? es?te???? ?????
    µ???pat??? ap? µ?a ????f? u se µ?a ????f? v e???
    s??dedeµ???? ???f?? ?s??ta? µe t?? e????st?
    a???µ? a?µ??, p?? ???????? t?? ????f?? u ?a? v.
  • ????sµa ??a? ???f?? G e??a? k-s??dedeµ???? ??
    p??? t?? a?µ??, a? ?a? µ???? a? ??a ta ?e???
    ????f?? e?????ta? µe t??????st?? k es?te???? ???a
    µ???p?t?a.

15
16
Ge???e?µ??? p??ß??µa s??d?sµ??
  • ?? ?e??µe?? p??ß??µa t?? s??d?sµ?? a?af??eta? st?
    p??ß??µa t?? e??es?? e????st?? ?e??????t??
    d??d???.
  • ??a e????st? ?e?????? d??d?? µe n3 ??e? ECVC1.
  • ?? ?e???e?µ??? p??ß??µa t?? s??d?sµ?? e??a? ?a
    ß?e?e? ?p????f?? d????t?? ???f?? µe e????st?
    ß????, ?ste ? s??desµ???t?ta ?a ?s??ta? µe l
  • ?? l1, t?te ta p??ß??µata ta?t????ta?.

???? e??a? p?? a???p?st? ?n8
VCEC4
VC1 EC3
16
17
Ge???e?µ??? p??ß??µa s??d?sµ??
  • Ta ?e????e? ? pe??pt?s? µ? ????sµ???? ???f??.
  • S??p?? e??a? ? e??es? e??? ???f?? µe n ????f??
    ?a? ep???af?? 0..n-1), l-s??ededeµ???? ?a? µe
    t?? e????st? a???µ? a?µ??.
  • ? ???f?? a?t?? s?µß????eta? µe Hl,n
  • ??a??????ta? t?e?? pe??pt?se??
  • l ??t?? (l2r).
  • l pe??tt? (l2r1), n ??t??.
  • l pe??tt? (l2r1), n pe??tt?.

17
18
Ge???e?µ??? p??ß??µa s??d?sµ??
  • l ??t?? (l2r). ??? ??µß?? i ?a? j e??a?
    ?e?t??????, a? ir j ir
  • l pe??tt? (l2r1), n ??t??. ?atas?e???eta? ?
    ???f?? H2r,n (?p?? ???). ?p?s?? d?? ??µß?? i ?a?
    in/2 e?????ta? ??a 1i n/2.
  • l pe??tt? (l2r1), n pe??tt?. ?atas?e???eta? ?
    ???f?? H2r,n. ?p?s?? e???eta? ? ??µß?? 0 µe t???
    (n1)/2 ?a? (n1)/2 ?a? ? ??µß?? i µe t?? ??µß?
    i(n1)/2 ??a 1i(n1)/2.

H4,8 H5,8 H5,9
18
19
Ge???e?µ??? p??ß??µa s??d?sµ??
  • Te???µa ? ???f?? ?l,n e??a? l-s??dedeµ????.
  • Te???µa ? e????st?? a???µ?? a?µ?? t?? ???f??
    ?l,n e??a? ceil(ln/2).

H4,8
H5,8
H5,9
19
20
?s?µ??f?sµ??
  • ???sµ?? ??? ???f?? G1(V1,E1) ?a? G2(V2,E2)
    ?????ta? ?s?µ??f????-isomorphic a? ?p???e? µ?a
    aµf?µ???s?µa?t? a?t?st????a f ap? t? t? s????? V1
    st? s????? V2 µe t?? ?d??t?ta ?t? ?? ????f?? a, b
    e??a? ?e?t?????? st? G1 a? ?a? µ??? a? ?? ????f??
    f(a), f(b) e??a? ?e?t?????? st? G2, ??a ???e
    ?e???? a,b t?? V1.
  • ? s????t?s? f ???µ??eta? ?s?µ??f???- isomorphism.

20
21
??ap?st?s? ?s?µ??f?sµ?? 1? ??s?
  • ???????µ?? e?????? ?s?µ??f?sµ??
  • ??s?d?? ???f?? G ?a? ???f?? ?
  • ???d?? ??? ? ???
  • ?? V(G)? V(H), t?te return OXI
  • Te????µe µ?a d??ta?? t?? ????f?? t?? G
  • ?ata???f??µe t?? p??a?a ?e?t???a? ?G t?? G
  • G?a ???e d??ta?? t?? ????f?? t?? H
  • ?ata???f??µe t?? p??a?a ?e?t???a? ?H
  • ?? ?G?H t?te return NAI
  • return OXI

????p????t?ta ?
21
22
??ap?st?s? ?s?µ??f?sµ?? 2? ??s?
  • ?st? ?t? ?? ???f?? a?apa??st??ta? µe t? µ???d?
    t?? p?????? p??spt?s?? (incidence matrix).
  • ?p??e? ? ??a? p??a?a? p??spt?s?? ?a
    µetas??µat?s?e? st?? ???? µ?s? a?t?µeta??se??
    ??aµµ?? ?/?a? st????. ?p?s?? µ? ap?te?esµat???
    ??s?.
  • ?p?????? ap?te?esµat???? a??????µ?? µ??? ??a
    e?d???? pe??pt?se?? ???f??.
  • ?p?s??, µp??e? ?a e??a? e????? ? ap?de??? ?t? d??
    ???f?? de? e??a? ?s?µ??f????

22
23
?µet?ß??te? invariants
  • S?????e? ??a t?? e????? d?ap?st?s? a? d?? ???f??
    de? e??a? ?s?µ??f????
  • ?d?a t????
  • ?d?? µ??e????
  • ?d?a a???????a ßa?µ???
  • ?d??? a???µ?? s???st?s???
  • G?a ???e s???st?sa t?? (4) apa?t??ta? ?et??? ??
    p??te? t?e?? e??t?se??
  • ????? ?? d?? ???f?? t? ?d?? ???µat??? p??????µ?
  • G?a nlt8, a? ??e? ?? e??t?se?? apa?t????? ?et???,
    t?te ?? ???f?? e??a? ?s?µ??f???? (??e?
    ap?de???e?).

23
24
?a?ade??µata - ?s??s?
f(a) e f(b) a f(c) b f(d) c f(e) d
f(a) 6 f(b) 1 f(c) 3 f(d) 5 f(e) 2 f(f)
4
24
25
?a?ade??µata - ?s??s?
25
26
Ge???e?s? ?s?µ??f?sµ??
  • ??? ???f?? e??a? 1-?s?µ??f???? a? ?a??sta?ta?
    ?s?µ??f???? µet? t?? epa?e???µµ??? d??spas? t??
    ap???pt??s?? ????f??.
  • ?a teµ???a e??? ???f?? e??a? ?s?µ??f??? p??? t??
    s???st?se? e??? ????? ???f??.

26
27
?a??de??µa
27
28
?a??de??µa ?s??s?
0
8
9
0
8
9
1
7
7
1
7
5
1
7
4
6
2
3
3
5
5
4
6
????? e??a? ? 1-?s?µ??f???? µe d??spas?
ap???pt??s?? ????f?? ?
28
29
Ge???e?s? ?s?µ??f?sµ??
  • ?? ? ???f?? ap?te?e?ta? ap? ??a teµ????, t?te ?
    ?????a t?? 1-?s?µ??f???t?ta? ta?t??eta? µe t??
    ?????a t?? ?s?µ??f???t?ta?.
  • Te???µa ?? d?? ???f?? e??a? 1-?s?µ??f????, t?te
    ? se??? ?a? ? µ?de????t?t? t??? e??a? ?se?.

29
30
??t?st????a ??????
  • ??? ???f?? ????? a?t?st????a ?????? circuit
    correspondence, a? ?p???e? aµf?µ???s?µa?t?
    a?t?st????a a?µ?? ?a? ??????, ?ts? ?ste ??a?
    ?????? t?? p??t?? ???f?? ?a ??e? a?t?st???? ?????
    st? de?te?? ???f?, p?? ap?te?e?ta? ap? t??
    a?t?st???e? a?µ??.
  • Te???µa ??? 1-?s?µ??f???? ???f?? ?????
    a?t?st????a ??????

30
31
2-?s?µ??f?sµ??
  • ??? ???f?? e??a? 2-?s?µ??f???? a? ?a??sta?ta?
    ?s?µ??f???? µet? t?? epa?e???µµ??? efa?µ??? µ?a?
    ? d?? ap? t?? e??? p???e??
  • d?ad????? d??spas? ap???pt??s?? ????f??
  • d?a????sµ?? t?? e??? ???f?? se d?? ??????
    ?p????f???, p?? ????? 2 ?e??? ?????? ????f?? ?a?
    epa?as??des? t?? ?p????f?? ta?t?p????ta? t??
    ????f?? µe d?af??et??? t??p?

31
32
2-?s?µ??f?sµ?? ?a??de??µa
32
33
2-?s?µ??f?sµ??
  • ??? ?s?µ??f???? ???f?? e??a? 1-?s?µ??f????, d??
    1-?s?µ??f???? ???f?? e??a? 2-?s?µ??f????. ??
    a?t??et? de? ?s??e?.
  • Te???µa (Whitney) ??? ???f?? e??a? 2-?s?µ??f????
    a? ?a? µ???? a? ????? a?t?st????a ??????

33
34
?a??de??µa
34
35
???????µ??
  • ???????µ?? d??s??s?? ???f??
  • BFS, a?a??t?s? ?at? p??t??
  • DFS, a?a??t?s? ?at? ß????
  • ?? a??????µ?? a?t?? ???s?µ?p?????ta?
  • ??a t?? e??es? ap?st?se?? ap? ??p??a ????f?
  • ??a t? d?ap?st?s? a? ???f?? e??a? s??dedeµ????
  • ??a t?? e??es? (?s???? s??dedeµ????) s???st?s??
  • ??a t?? t?p??????? ta????µ?s?
  • ??a t?? e??es? t?? s?µe??? ?????s??
  • ??a t?? e??es? ?ef????
  • ??a t? d?ap?st?s? ??????
  • ??a t? d?ap?st?s? ep?ped???t?ta?

35
36
BFS vs DFS
  • BFS
  • 1959 Moore
  • ?p?s?ept?µaste t?? p?? ???? ??µß?
  • ???p???s? µe ????.
  • DFS
  • 1973 Hopcroft-Tarjan
  • ?p?s?ept?µaste t?? p?? ßa?? ??µß?
  • ???p???s? µe st??ßa.

? d?af??? ???e?ta? st? d?µ? ded?µ????!
36
37
BFS se d??d??
37
38
DFS se d??d??
?a?t??eta? µe t?? p??d?ateta?µ??? (preorder)
d??s??s?
38
39
BFS vs DFS
dfs(G) list L empty tree T
empty choose a starting vertex x
visit(x) while(L nonempty)
remove edge (v,w) from end of
L if w not visited
add (v,w) to T visit(w)
bfs(G) list L empty tree T
empty choose a starting vertex x
visit(x) while(L nonempty)
remove edge (v,w) from
beginning of L if w not visited
add (v,w) to T
visit(w)
Visit ( vertex v) mark v as visited
for each edge (v,w) add edge
(v,w) to end of L
39
40
BFS ???es? ap?st?se??
  • ??s?d?? ???f?? G µe ep???af?? ?a? ????f? x?V
  • ???d?? ?? ap?st?se?? ap? t?? ????f? x p??? ??e?
    t?? ????f?? p?? e??a? p??spe??s?µe? ap? a?t??
  • T?t??µe i?0. St?? ????f? x ??t??µe t?? ep???af?
    i.
  • ???s???µe ??e? t?? ????f?? ????? ep???af?? p??
    e??a? ?e?t?????? p??? t??????st?? µ?a ????f? µe
    ep???af? i
  • ?? de? ?p???e? ??p??a t?t??a ????f?, t?te ?
    ???f?? e?a?t?????e.
  • T?t??µe t?? ep???af? i1 se ??e? t?? ????f?? p??
    ß?????a? st? ??µa 2
  • T?t??µe i?i1. ???a????µe st? ??µa 2

40
41
BFS ???es? ap?st?se??, ? ?d?a
  • Se ???e ??????? st??µ? ?p???e? ??a µ?t?p?
    ????f?? p?? t?? ????µe a?a?a???e?, a??? de? t??
    ????µe a??µ? epe?e??as?e?
  • ?aµß????µe d?ad????? t?? ????f?? t?? µet?p??
    ?a? a?a?a??pt??µe t??? ?e?t??e? d?µ???????ta? ??a
    ??? µ?t?p?

s
  • ?sp?e? ????f?? µ? µa??a??sµ??e? ?a? e?t?? ?????
  • G??? ????f?? µa??a??sµ??e? ?a? e?t?? ?????
  • ?a??e? ????f?? µa??a??sµ??e? ?a? e?t?? ?????

42
??a??t??? BFS a?????p???s?
  • procedure BFS(Ggraph snodevar colorcarray
    distiarray parentparray)
  • for each vertex u do
  • coloruwhite
  • distu8
  • parentunil
  • colorsgray dists0
  • init(Q) enqueue(Q, s)

?(n)
42
43
??a??t??? BFS main
  • while not (empty(Q)) do
  • uhead(Q)
  • for each v in adju do
  • if colorvwhite then
  • colorvgray
  • distvdistu1
  • parentvu
  • enqueue(Q,v)
  • dequeue(Q) colorublack
  • end BFS

O(m)
43
44
?a??de??µa BFS
r s t u
r s t u


0
1
0



s
w r




1



v w x y
v w x y r s
t u r s
t u
1
2


0
1
0
2
r t x
t x v
2


2

1
1
2
v w x y v
w x y
44
45
?a??de??µa BFS s????e?a
r s t u
r s t u
3
1
0.
0
3
2
2
1
x v u
v u y
2
2

1
1
2
2
3
v w x y
v w x y r s
t u r s
t u
3
1
0
2
1
0
2
3
u y
y
3
2
3
2
2
1
1
2
v w x y v
w x y
?????, ? ????f? y ß?a??e? ap? t?? ???? ?a?
µa????eta?
45
46
????p????t?ta t?? BFS
  • ??????p???s? T(n).
  • ???e ??µß?? µpa??e? st?? ???? µ?a f??? (ap?
    ?sp??? ???eta? ????) ?a? ? ??sta ?e?t??as??
    d?as???eta? µ?a f???.
  • ?? p???, ??e? ?? ??ste? d?as?????ta?.
  • ???e a?µ? ?aµß??eta? d?? f????, ?p?te ? ß?????
    epa?a?aµß??eta? t? p??? 2E f????.
  • ?e???te?? pe??pt?s? O(nm)
  • ?? ? ???f?? e??a? ???p???µ???? µe p??a?a
    ?e?t??as??, t?te ? p???p????t?ta e??a? ?(n2).

46
47
BFS tree
?se? a?µ?? t?? ???f?? G pa???s?????ta? st? BFS
tree ???µ????ta? de?d????? tree edges, ??
?p????pe? ???µ????ta? d?asta????µe?e? cross
edges.
47
48
DFS ??a??t?s? ?at? ß????
  • ???????µ?? DFS t?? Hopcroft-Tarjan (1973)
  • ??s?d?? ???f?? G µe ep???af?? ?a? ????f? x?V
  • ???d?? s????? ? de?d????? ????f?? ?a? a???µ?s?
    dfi(v)
  • T?t??µe T?Ø, i?1.
  • G?a ???e v?V, ??t??µe dfi(v)?0
  • G?a ???e u µe dfi(u) e?te?e?ta? DFS(u).
  • St?? ???d? d??eta? t? s????? ?.
  • ??ad??as?a DFS(v)
  • T?t??µe dfi(v)?i, i?i1
  • G?a ???e u ?N(v) e?te????ta? ?? e?t????
  • ?? dfi(u)0, t?te ??t??µe T?TUe, ?p??
    e(u,v) µ?a µ? ???s?µ?p???µ??? p??sp?pt??sa
    a?µ?, ?a? l(e)?used
  • ?a???µe t?? DFS(u)

48
49
DFS tree
?se? a?µ?? t?? ???f?? G pa???s?????ta? st? DFS
tree ???µ????ta? de?d????? tree edges, ??
?p????pe? ???µ????ta? ?p?s??e? back edges.
49
50
?p?s??e? a?µ??
0
1
4
2
9
5
11
7
6
8
10
DFS Tree
  • Te???µa ???e ?p?s??a a?µ? (u,v) p?? p????pte?
    ?at? t?? a?a??t?s? ?at? ß???? (DFS) e??? µ?
    ?ate?????µe??? ???f?? e???e? ????f?? p??
    ß??s???ta? se s??s? ap??????/p???????.

50
51
??a??t??? DFS
  • procedure DFS(Ggraph var color carray
    d,fiarray parentparray)
  • for each vertex u do
  • coloruwhite parentunil
  • time0
  • for each vertex u do
  • if coloruwhite then DFS-Visit(u)
  • end DFS

?(n)
52
??a??t??? DFS-visit(u)
  • colorugray timetime1 dutime
  • for each v in adju do
  • if colorvwhite then
  • parentvu DFS-Visit(v)
  • colorublack timetime1
  • futime
  • end DFS-Visit

53
?a??de??µa DFS
u v w
u v w
1/
1/
2/
x y z
x y z
u v w
u v w
1/
2/
1/
2/
B
3/
3/
4/
x y z
x y z
54
?a??de??µa DFS
u v w
u v w
1/
2/
1/
2/
B
B
3/
3/6
4/5
4/5
x y z
x y z
u v w
1/
2/7
B
3/6
4/5
x y z
55
?a??de??µa DFS
u v w
1/8
2/7
9
C
B
F
3/6
4/5
10
x y z
x y z
u v w
u v w
1/8
2/7
9
9/12
1/8
2/7
B
F
C
B
F
C
3/6
4/5
10/11
3/6
4/5
10/11
x y z
x y z
56
????p????t?ta t?? DFS
  • ??????p???s? T(n).
  • ? DFS-visit ?a?e?ta? µ?a f??? ??a ???e ??µß? v.
  • ? ß????? for e?te?e?ta? dv f????.
  • S??????? ? DFS-visit ?a?e?ta? T(m) f????.
  • ?e???te?? pe??pt?s? T(nm)

57
?fa?µ???? t?? DFS
  • O ???f?? G e??a? s??dedeµ????? ??te???µe
    DFS-Visit(v). ?? p??se??????µe ??e? t?? ????f??,
    t?te NAI, a????? OXI. O(nm)
  • ? ???f?? G e??a? d??d??? ??te???µe
    DFS-Visit(v). ?? p??se??????µe ??e? t?? ????f??
    ?a? de? ?p?????? ?p?s??e? a?µ??, t?te ???, a?????
    OXI. O(n)
  • ???es? teµa????. ??te???µe DFS. ??a??t??µe st??
    ????f?? e??? teµa???? ??a id. T(nm)
  • ???es? ??????. ??te???µe DFS. ?? ?p??????
    ?p?s??e? a?µ??, t?te NAI, a????? ???. O(n) d??t?
    p??se??????ta? t? p??? n a?µ??. ???s??? ?? a?µ??
    (u,v) ?a? (v, u) de? ap?te???? ?????.

58
???????µ?? e??es?? teµa???? µe DFS
  • ???e? ?a e?t?p?st??? ?? ap???pt??se? ????f?? ??
    e???
  • ?? µ?a ap???pt??sa ????f? v e??a? ? ???a t??
    d??d??? DFS, t?te ? v p??pe? ?a ??e? pe??ss?te??
    ap? ??a ???.
  • ?? µ?a ap???pt??sa ????f? v de? e??a? ???a, t?te
    p??pe? ? v ?a ??e? ??a ??? s, t?? ?p???? ??p????
    ap?????? (s?µpe???aµßa??µ???? t?? s) ?a s??d?eta?
    µe ??a? p?????? t?? v µ?s? 1 ?p?s??a? a?µ?? t?
    p???.
  • G?a ???e ????f? v ????eta? e?t?? ap? t? d(v) ?a?
    µ?a ep?p???? µetaß??t?, ? l(v), p?? d????e? t?
    µ????te?? ap? t?? ep???af?? d(v) ?a? d(s), ?p?? s
    e??a? e?te ap?????? t?? v, e?te p??????? µ?s?
    µ?a? t? p??? ?p?s??a? a?µ??, p?? e???e? t??
    p?????? a?t? µe ??a? ap????? t?? v.
  • ??a ? µ???st? t?µ? p?? µp??e? ?a p??e? ? l(v)
    e??a? d(v).
  • ??a ??a ?a ?s??e? t? 2, p??pe? l(s)?d(v)

58
59
?p?????sµ?? pa?aµ?t??? l(v)
  • ?????? l(v)d(v).
  • ? ?p?????sµ?? t?? l(v) ???eta? ??t??ta? t?? t?µ?
    t?? ?s? µe t? e????st? st???e?? t?? s??????
  • d(v)?l(s) s ???? t?? v?d(w) (s,w) µ?a
    ?p?s??a a?µ?
  • ? l(v) e??µe???eta? ?p?te p??spe???eta? ??a? ????
    s, t?t???? ?ste l(v)?l(s) ? ?p?te ß??s?eta? µ?a
    ?p?s??a a?µ?. ??t? µp??e? ?a ep?te???e? µe t?
    ß???e?a µ?a? st??ßa?.
  • ?p???pt??se? ????f?? e??a? ?se? l(u)?d(v)

59
60
???????µ??
  • ??s?d?? ??a? ???f?? G µe ep???af?? ?a? µ?a
    ????f?
  • ???d?? ?? ????f?? se ???e teµ???? t?? G
  • 1. T?t??µe i?1 ?a? ade?????µe t? st??ßa.
  • 2. G?a ???e v?V ??t??µe d(v)?0
  • 3. ??? d(v)0 ??a ??p??? v ?a???µe t??
    findblocks(v,0).
  • ??ad??as?a findblocks(v,w)
  • 1. T?t??µe, d(vi)?1, l(vi) ?d(vi), i?i1
  • 2.G?a ???e u?N(v)
  • ?? df i(v)0, t?te e?te????ta? ta e??? ß?µata
  • ? a?µ? (u,v) µpa??e? st? st??ßa a? de? e??a?
    a??µ? e?e?
  • ?a?e?ta? ? findblocks(u,0)
  • T?t??µe l(v)?min(l(v),l(u))

60
61
???????µ?? (s????e?a)
  • ?? l(u)dfi(v), t?te ap?????ta? ap? t? st??ßa
    ?a? d????ta? st?? ???d? ??e? ?? a?µ?? ap? t??
    ????f? t?? st??ßa? µ???? ?a? t?? a?µ? (u,v) (st?
    st?d?? a?t? ? v e??a? e?te ???a e?te ap???pt??sa
    ????f?)
  • ??????, a? df i(u)ltdf i(v) ?a? u ? w t?te
    e?te????ta?
  • O???µe t?? a?µ? (v,w) st? st??ßa
  • T?t??µe l(v)?min(l(v),l(w))

61
62
?a??de??µa
?e?????ta? ap? t?? ????f? 1, ?a d????? ta dfi
?a? l ??a ??e? t?? ????f??
62
63
?a??de??µa
St? ???f? (a) ?e?????µe ap? t?? ????f? ?. ?a
e???????? d?ad????? ?? t?µ?? t?? dfi ?a? l.
63
64
?a??de??µa
?a e???????? ?? t?µ?? dfi ?a? l.
64
Write a Comment
User Comments (0)
About PowerShow.com