Longest Path in a DAG - PowerPoint PPT Presentation

About This Presentation
Title:

Longest Path in a DAG

Description:

for each edge v-w, set fin[w] = max(fin[w], fin[v] ... A. B. C. G. H. D. E. F. I. 4. 6. 2. 5. 3. 4. 6. 0. 0. 4. 6. 19. 25. 0. 25. 13. 10. 15. critical path ... – PowerPoint PPT presentation

Number of Views:1024
Avg rating:3.0/5.0
Slides: 13
Provided by: kevin59
Category:
Tags: dag | critical | longest | path

less

Transcript and Presenter's Notes

Title: Longest Path in a DAG


1
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.

F
D
3
6
E
time
5
C
H
I
A
B
G
0
6
4
0
2
4
2
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.

0
earliest finish time
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
3
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
4
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
5
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
6
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
7
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
8
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
9
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
10
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
11
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

0
0
F
D
3
0
6
E
5
0
0
0
0
0
0
C
H
I
A
B
G
0
6
4
0
2
4
12
Longest Path in a DAG
  • Algorithm.
  • Compute topological order of vertices A B C D
    E F G H I.
  • Initialize finv 0 for all vertices v.
  • Consider vertices v in topological order
  • for each edge v-w, set finw max(finw,
    finv timew)

13
10
F
D
3
15
6
E
critical path
5
19
0
6
25
25
4
C
H
I
A
B
G
0
6
4
0
2
4
Write a Comment
User Comments (0)
About PowerShow.com