Longest Path in a DAG PowerPoint PPT Presentation

presentation player overlay
About This Presentation
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