A Batch Algorithm for Maintaining a Topological Order David J. Pearce and Paul H.J. Kelly Victoria...

Preview:

Citation preview

A Batch Algorithm for Maintaining a Topological Order

David J. Pearce and Paul H.J. Kelly

Victoria University of Wellington,New Zealand

& Imperial College, London

Topological Orders

1

23

4

76

8

5

9

Topological Orders

2 3 4 5 6 7 81 9

1

23

4

76

8

5

9

Updating Topological Orders

1

23

4

76

8

5

9

2 3 4 5 6 7 81 9

Updating Topological Orders

2 3 4 5 6 7 81 9

Affected Region

1

23

4

76

8

5

9

Updating Topological Orders

2 3 4 5 6 7 81 9

Affected Region

Updating Topological Orders

Unit Change Problem

2 3 4 5 6 7 81 92004: Pearce, et al.

1990: Alpern, et al.

1996: Marchetti-Spaccamela, et al.

2006: Ajwani, et al.

2009: Bender, et al.

2008: Haeupler, et al.

2005: Katriel, et al.

2007: Liu, et al.

1

23

4

76

8

5

9

1 2 3 4 5 6 7 8 9

1

23

4

76

8

5

9

1 2 3 4 5 6 7 8 9

1

23

4

76

8

5

9

1 2 3 45 6 7 8 9

1 2 3 4 5 6 7 8 9

1

23

4

76

8

5

9

1 2 3 45 6 7 8 9

1 2 3 4 5 6 7 8 9

1 2 3 45 6 7 89

Batch Problem

Definition: Given a batch of edge insertions, update the topological order

Q) Can we do better than by processing them one at a time?

Batch Problem

Definition: Given a batch of edge insertions, update the topological order

Q) Can we do better than by processing them one at a time?

A) Yes!

Previous MNR Algorithm

2 3 4 5 6 7 81 9

Discovery – DFS to identify nodes reachable from tail in affected region

Previous MNR Algorithm

2 3 4 5 6 7 81 9

Discovery – DFS to identify nodes reachable from tail in affected region

Previous MNR Algorithm

2 3 4 5 6 7 81 9

Discovery – DFS to identify nodes reachable from tail in affected region

Previous MNR Algorithm

2 3 4 5 6 7 81 9

Discovery – DFS to identify nodes reachable from tail in affected region

Previous MNR Algorithm

2 3 4 5 6 7 81 9

Discovery – DFS to identify nodes reachable from tail in affected region

Previous MNR Algorithm

2 3 4 5 6 7 81

9

Shift – marked nodes up the order, unmarked nodes down the order (in affected region)

Previous MNR Algorithm

2 3 4 5 6 7 81

9

Shift – marked nodes up the order, unmarked nodes down the order (in affected region)

Previous MNR Algorithm

2 3 4 5 6 7 81

9

Shift – marked nodes up the order, unmarked nodes down the order (in affected region)

Previous MNR Algorithm

2 3 4 5 6 7 81

9

Shift – marked nodes up the order, unmarked nodes down the order (in affected region)

Previous MNR Algorithm

2 3 45 6 7 81

9

Shift – marked nodes up the order, unmarked nodes down the order (in affected region)

Previous MNR Algorithm

2 3 45 6 7 81

9

Shift – marked nodes up the order, unmarked nodes down the order (in affected region)

MNR Algorithm

2 3 45 6 7 81 9

Shift – marked nodes up the order, unmarked nodes down the order (in affected region)

Our Novel Batch Algorithm

Observation – edge insertions which overlap can be processed independently of others

Our Novel Batch Algorithm

Observation – edge insertions which overlap can be processed independently of others

Affected Region Affected Region

Our Novel Batch Algorithm

Discovery – identify “target node” for each node reachable from an insertion in affected region

45 67 2 13

Our Novel Batch Algorithm

Discovery – identify “root node” for each node reachable from an insertion in affected region

45 67 2 13

Our Novel Batch Algorithm

Discovery – identify “root node” for each node reachable from an insertion in affected region

45 67 2 13

Our Novel Batch Algorithm

Discovery – identify “root node” for each node reachable from an insertion in affected region

45 67 2 134 44

Our Novel Batch Algorithm

Discovery – identify “root node” for each node reachable from an insertion in affected region

45 67 2 134 44 1 1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 67 2 134 44 1 1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7

2 134 4

4

1 1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7

2 134 4

4

1 1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7 2

134 4

4 1

1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7 2

134 4

4 1

1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7 2

1

3

4 4

4 1 1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7 2

1

3

4 4

4 1 1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7

21

3

4 4

4 1

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

45 6

7

21 34 4

4

Our Novel Batch Algorithm

Shift – marked nodes up order and unmarked nodes down order; marked nodes moved just past their target

4 5 6 721 3

Results on Sparse Random Graphs

Results on Sparse Random Graphs

Results on Denser Random Graphs

Results on Denser Random Graphs

Applications

• Extensions:– Incremental Cycle Detection

• Applications:– Pointer Analysis– Software Model Checking– Constraint-based Local Search

Algorithms– Dead-lock Detection– Machine Learning– Multiple Sequence Alignment

Conclusion

That’s all folks!