Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Optimization Depth First Search

Similar presentations


Presentation on theme: "Network Optimization Depth First Search"— Presentation transcript:

1 Network Optimization Depth First Search
Get ahold of a network, and use the same network to illustrate the shortest path problem for communication newtorks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.) James Orlin

2 Initialize 1 2 4 5 3 6 9 7 8 1 2 4 5 3 6 9 7 8 1 1 Unmark all nodes in N; Mark node 1 and add it to LIST LIST 1

3 Select a node i in LIST 1 2 4 5 3 6 9 7 8 1 1 1 Select last node in LIST LIST 1

4 If node i is incident to an admissible arc…
2 4 2 2 8 1 1 1 1 5 7 Scan an arc out of node 1. 9 3 6 If endpoint is unmarked, then mark it and add it to LIST. LIST 1 2

5 Select the last node on LIST
2 4 2 2 2 8 1 1 1 1 1 5 7 Select Node 2. 9 3 6 LIST 1 2

6 If node i is incident to an admissible arc…
2 4 4 2 2 2 3 8 1 1 1 1 1 5 7 Scan arc out of node 2. 9 3 6 Mark node 4 and add it to LIST. LIST 1 2 4

7 Select 2 4 4 4 2 2 2 2 3 8 1 1 1 1 1 5 7 Select node 4 9 3 6 LIST 1 2

8 If node i is incident to an admissible arc…
2 4 4 4 2 2 2 2 3 8 8 4 1 1 1 1 1 5 7 Scan arc out of node 4. 9 3 6 Mark 8 and add it to LIST. LIST 1 2 4 8

9 Select 2 4 4 4 2 2 2 2 3 8 8 8 4 1 1 1 1 1 5 7 Select node 8 9 3 6 LIST 1 2 4 8

10 If node i is not incident to an admissible arc…
2 4 4 4 2 2 2 2 3 8 8 8 4 1 1 1 1 1 5 7 If there are no unscanned arcs out of node 8, delete it from LIST. 9 3 6 LIST 1 2 4 8

11 Select 2 4 4 4 4 2 2 2 2 3 8 8 8 8 4 1 1 1 1 1 5 7 Select Node 4 9 3 6 LIST 1 2 4 8

12 If node i is incident to an admissible arc…
2 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 1 1 1 1 5 5 7 Scan arc out of node 4. 9 3 6 Mark 5 and add it to LIST. LIST 1 2 4 8 5

13 Select 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 1 1 1 1 5 5 5 7 Select node 5 9 3 6 LIST 1 2 4 8 5

14 If node i is incident to an admissible arc…
2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 1 1 1 1 5 5 5 7 Scan arc out of node 5. 9 3 6 6 Mark 6 and add it to LIST. 6 LIST 1 2 4 5 8 6

15 Select the last node on LIST
2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 1 1 1 1 5 5 5 5 7 Select node 6 9 3 6 6 6 6 LIST 1 2 4 5 8 6

16 If node i is incident to an admissible arc…
2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 1 1 1 1 5 5 5 5 7 Scan arc out of node 6. 9 9 3 6 6 6 7 Mark 9 and add it to LIST. 6 LIST 1 2 4 5 8 6 9

17 Select the last node on LIST
2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 1 1 1 1 5 5 5 5 7 Select node 9 9 9 9 3 6 6 6 6 7 6 LIST 1 2 4 8 5 6 9

18 If node i is incident to an admissible arc…
2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 Scan arc out of node 9. 9 9 9 3 6 6 6 6 7 Mark 7 and add it to LIST. 6 LIST 1 2 4 8 5 6 9 7

19 Select the last node on LIST
2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 Select node 7 9 9 9 9 3 6 6 6 6 7 6 LIST 1 2 4 8 5 6 9 7

20 Scan arc (7,4) 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 Scan arc out of node 7 9 9 9 9 3 6 6 6 6 7 6 If endpoint is marked, then label arc as “scanned”. LIST 1 2 4 8 5 6 9 7

21 Scan arc (7,5) 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 Scan arc out of node 7 9 9 9 9 3 6 6 6 6 7 6 If endpoint is marked, then label arc as “scanned”. LIST 1 2 4 8 5 6 9 7

22 Scan arc (7,8) 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 Scan arc out of node 7 9 9 9 9 3 6 6 6 6 7 6 If endpoint is marked, then label arc as “scanned”. LIST 1 2 4 8 5 6 9 7

23 If node i is not incident to an admissible arc…
2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 There are no arcs out of 7. Delete 7 from LIST 9 9 9 9 3 6 6 6 6 7 6 LIST 1 2 4 8 5 6 9 7

24 Select node 9 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 7 Select node 9. 9 9 9 9 9 3 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

25 Scan (9,4) 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 7 Scan arc out of node 9. 9 9 9 9 9 3 6 6 6 6 7 6 If endpoint is marked, then label arc as “scanned”. LIST 1 2 4 8 5 6 9 7

26 Delete 9 from LIST 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 7 Node 9 has no incident arcs. Delete it from list. 9 9 9 9 9 3 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

27 Select node 6 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 7 Select node 6. 9 9 9 9 9 9 3 6 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

28 Scan arc (6.7) 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 7 Select arc out of node 6. 9 9 9 9 9 9 3 6 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

29 Select node 6 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 7 7 7 7 Delete node 6 from LIST 9 9 9 9 9 9 3 6 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

30 Select node 5 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 5 7 7 7 7 9 9 9 9 9 9 Select Node 5 3 6 6 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

31 Select node 5 2 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 5 7 7 7 7 9 9 9 9 9 9 3 6 6 6 6 6 6 Delete node 5 from LIST 7 6 LIST 1 2 4 5 8 6 9 7

32 Select node 4 2 4 4 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Select node 4 9 9 9 9 9 9 3 6 6 6 6 6 6 7 6 LIST 1 2 4 8 5 6 9 7

33 Delete node 4 2 4 4 4 4 4 4 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Delete node 4 from LIST 9 9 9 9 9 9 3 6 6 6 6 6 6 7 6 LIST 1 2 4 8 5 6 9 7

34 Select node 2 2 4 4 4 4 4 4 4 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Select Node 2 9 9 9 9 9 9 3 6 6 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

35 Scan arc (2,5) 2 4 4 4 4 4 4 4 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Scan arc out of node 2 9 9 9 9 9 9 3 6 6 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

36 Delete node 2 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 5 5 5 5 5 5 7 7 7 7 9 9 9 9 9 9 3 6 6 6 6 6 6 Delete node 2 from LIST 7 6 LIST 1 2 4 8 5 6 9 7

37 Select node 1 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Select node 1 9 9 9 9 9 9 3 6 6 6 6 6 6 7 6 LIST 1 2 4 5 8 6 9 7

38 Scan arc (1,3) 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Scan arc out of node 1 9 9 9 9 9 9 3 3 6 6 6 6 6 6 7 9 6 LIST 1 3 2 4 8 5 6 9 7

39 Select node 3 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Select node 3 9 9 9 9 9 9 3 3 3 6 6 6 6 6 6 7 9 6 LIST 1 3 2 4 5 8 6 9 7

40 Scan arcs (3,5) and (3,6) 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Scan arcs out of node 3 9 9 9 9 9 9 3 3 3 6 6 6 6 6 6 7 9 6 LIST 1 3 2 4 5 8 6 9 7

41 Delete node 3 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Delete node 3 from LIST 9 9 9 9 9 9 3 3 3 6 6 6 6 6 6 7 9 6 LIST 1 3 2 4 8 5 6 9 7

42 Select node 1 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Select node 1 9 9 9 9 9 9 3 3 3 3 6 6 6 6 6 6 7 9 6 LIST 1 2 3 4 5 8 6 9 7

43 Scan arc (1, 5) 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Scan arc out of (1,5) 9 9 9 9 9 9 3 3 3 3 6 6 6 6 6 6 7 9 6 LIST 1 2 3 4 5 8 6 9 7

44 Delete node 1 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 Delete node 1 from LIST 9 9 9 9 9 9 3 3 3 3 6 6 6 6 6 6 7 9 6 LIST 1 2 3 4 5 8 6 9 7

45 LIST is empty 2 4 4 4 4 4 4 4 2 2 2 2 2 2 3 8 8 8 8 4 5 1 8 1 1 1 1 1 1 1 1 5 5 5 5 5 5 7 7 7 7 The algorithm ends! 9 9 9 9 9 9 3 3 3 3 6 6 6 6 6 6 7 9 6 LIST 1 2 3 4 5 8 6 9 7

46 The depth first search tree
1 3 2 9 8 7 5 4 6 Note that each induced subtree has consecutively labeled nodes

47 15.082J / 6.855J / ESD.78J Network Optimization
MITOpenCourseWare 15.082J / 6.855J / ESD.78J Network Optimization Fall 2010 For information about citing these materials or our Terms of Use, visit:


Download ppt "Network Optimization Depth First Search"

Similar presentations


Ads by Google