mit15_082jf10_av01.ppt

Upload: henrique-mariano-amaral

Post on 02-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 MIT15_082JF10_av01.ppt

    1/35

    Breadth first search animation

    Network Optimization

    Breadth First Search

  • 8/10/2019 MIT15_082JF10_av01.ppt

    2/35

    Breadth first search animation 2

    Initialize

    LIST

    Unmark allnodes in N;

    1

    2 4

    5

    3 6 9

    7

    8

    1

    2 4

    5

    3 6 9

    7

    8

    11

    Mark node 1

    and add it to

    LIST.

    1

  • 8/10/2019 MIT15_082JF10_av01.ppt

    3/35

    Breadth first search animation 3

    Select node 1

    LIST

    Select thefirst node

    in LIST.

    1

    2 4

    5

    3 6 9

    7

    8

    1

    1

    1

    1

    1

    2

    3

    Arc numbers for arcs in A(i) refer to the

    order in which arcs of A(i) are scanned.

  • 8/10/2019 MIT15_082JF10_av01.ppt

    4/35

    Breadth first search animation 4

    Scan arcs (1,2)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    1

    1

    1

    1

    Find an

    admissible

    arc

    22

    2

    1

    2

    3

  • 8/10/2019 MIT15_082JF10_av01.ppt

    5/35

    Breadth first search animation 5

    Scan arc (1,5)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    3

    1

    1

    1

    1

    22

    2 5

    5

    Select node 1

    and find an

    admissible

    arc.

    1

    2

    3

  • 8/10/2019 MIT15_082JF10_av01.ppt

    6/35

    Breadth first search animation 6

    4

    Scan arc (1,3)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    3

    1

    1

    1

    1

    22

    2 5

    5

    3

    3

    Select node 1

    and find an

    admissible

    arc.

    1

    2

    3

  • 8/10/2019 MIT15_082JF10_av01.ppt

    7/35

    Breadth first search animation 7

    4

    Delete Node 1 from LIST

    LIST

    Delete node 1

    from LIST

    1

    2 4

    5

    3 6 9

    7

    8

    31

    1

    1 1

    22

    2 5

    5

    3

    3

    1

  • 8/10/2019 MIT15_082JF10_av01.ppt

    8/35

    Breadth first search animation 8

    4

    Select Node 2

    LIST

    Select first

    node on LIST

    1

    2 4

    5

    3 6 9

    7

    8

    31

    1

    1 1

    22

    2 5

    5

    3

    3

    1

    21

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    9/35

    Breadth first search animation 9

    5

    4

    Scan arc (2, 4)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    31

    1

    1

    22

    2 5

    5

    3

    3

    2

    Select anadmissible

    arc

    4

    4

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    10/35

    Breadth first search animation 10

    5

    4

    Scan arc (2, 5)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    31

    1

    1

    22

    2 5

    5

    3

    3

    2

    Ignore anyscanned arcs

    out of node 2

    that are not

    admissible.

    4

    4

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    11/35

    Breadth first search animation 11

    5

    4

    Delete node 2

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    2 5

    5

    3

    3

    2

    Delete node 2

    from LIST

    4

    4

    2

    1

  • 8/10/2019 MIT15_082JF10_av01.ppt

    12/35

    Breadth first search animation 12

    5

    4

    Select node 5

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    5

    3

    3

    2 4

    4

    Select thefirst node on

    LIST

    5

    1

  • 8/10/2019 MIT15_082JF10_av01.ppt

    13/35

    Breadth first search animation 13

    6

    5

    4

    Scan arc (5,6)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    5

    3

    3

    2 4

    4

    5

    Find an

    admissible

    arc6

    6

    1

  • 8/10/2019 MIT15_082JF10_av01.ppt

    14/35

    Breadth first search animation 14

    6

    5

    4

    Delete node 5

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    5

    3

    3

    2 4

    4

    5

    6

    6

    Delete node 5

    from LIST

    5

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    15/35

    Breadth first search animation 15

    6

    5

    4

    Select node 3

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    3

    2 4

    4

    5

    6

    6

    Select first

    node on LIST

    5

    3

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    16/35

    Breadth first search animation 16

    6

    5

    4

    Scan arcs out of node 3

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    3

    2 4

    4

    5

    6

    6

    Ignore any

    scanned arc

    that is not

    admissible.

    5

    3

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    17/35

    Breadth first search animation 17

    6

    5

    4

    Delete node 3

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    3

    2 4

    4

    5

    6

    6

    Delete node 3

    from LIST

    5

    33

  • 8/10/2019 MIT15_082JF10_av01.ppt

    18/35

    Breadth first search animation 18

    6

    5

    4

    Select node 4

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    4

    6

    6

    Select thefirst node on

    LIST

    41

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    19/35

    Breadth first search animation 19

    7

    6

    5

    4

    Scan arc (4, 8)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    31

    1

    1

    22

    2 5

    5

    3

    3

    4

    4

    6

    6

    4

    Look for an

    admissible

    arc.

    8

    8

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    20/35

    Breadth first search animation 20

    7

    6

    5

    4

    Scan arc (4, 5)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    4

    6

    6

    4

    Look for an

    admissible

    arc

    8

    8

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    21/35

    Breadth first search animation 21

    7

    6

    5

    4

    Delete Node 4

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    4

    6

    6

    4

    Delete node 4

    from LIST

    8

    8

    4

  • 8/10/2019 MIT15_082JF10_av01.ppt

    22/35

  • 8/10/2019 MIT15_082JF10_av01.ppt

    23/35

    Breadth first search animation 23

    8

    7

    6

    5

    4

    Scan arc (6,7)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    31

    1

    1

    22

    2 5

    5

    3

    3

    4

    4

    6

    6

    8

    8

    6

    Scan arcs out

    of node 6 one

    at a time.

    7

    7

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    24/35

    Breadth first search animation 24

    9

    8

    7

    6

    5

    4

    Scan arc (6,9)

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    6

    8

    8

    6

    7

    7

    9

    9

    Scan arcs out

    of node 6 one

    at a time.

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    25/35

    Breadth first search animation 25

    9

    8

    7

    6

    5

    4

    Delete node 6

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    6

    8

    8

    6

    Delete node 6

    from LIST

    7

    7

    96

    9

  • 8/10/2019 MIT15_082JF10_av01.ppt

    26/35

    Breadth first search animation 26

    9

    8

    7

    6

    5

    4

    Select node 8

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    8

    6

    Select first

    node on LIST

    7

    7

    96

    9

    8

  • 8/10/2019 MIT15_082JF10_av01.ppt

    27/35

    Breadth first search animation 27

    9

    8

    7

    6

    5

    4

    Delete node 8

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    8

    6

    Delete node 8

    7

    7

    96

    9

    88

  • 8/10/2019 MIT15_082JF10_av01.ppt

    28/35

    Breadth first search animation 28

    9

    8

    7

    6

    5

    4

    Select node 7

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    6

    Select first

    node on LIST

    7

    7

    96

    9

    71

    2 3

  • 8/10/2019 MIT15_082JF10_av01.ppt

    29/35

    Breadth first search animation 29

    9

    8

    7

    6

    5

    4

    Scan arcs out of node 7

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    6

    Scan arcs out

    of node 7 one

    at a time.

    7

    7

    96

    9

    71

    2 3

  • 8/10/2019 MIT15_082JF10_av01.ppt

    30/35

    Breadth first search animation 30

    9

    8

    7

    6

    5

    4

    Delete node 7

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    6

    Delete node 7

    from LIST

    7

    7

    96

    9

    77

  • 8/10/2019 MIT15_082JF10_av01.ppt

    31/35

    Breadth first search animation 31

    9

    8

    7

    6

    5

    4

    Select node 9

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    6

    Select the

    first node on

    LIST

    7

    96

    9

    9

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    32/35

    Breadth first search animation 32

    9

    8

    7

    6

    5

    4

    Scan arcs out of node 9

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    6

    Scan arcs out

    of node 9,

    one at a time

    7

    96

    9

    9

    1

    2

  • 8/10/2019 MIT15_082JF10_av01.ppt

    33/35

    Breadth first search animation 33

    9

    8

    7

    6

    5

    4

    Delete node 9

    LIST

    1

    2 4

    5

    3 6 9

    7

    8

    311

    22

    5

    3

    4

    6

    8

    6

    Delete node 9

    from LIST

    7

    96

    9

    99

  • 8/10/2019 MIT15_082JF10_av01.ppt

    34/35

  • 8/10/2019 MIT15_082JF10_av01.ppt

    35/35

    MITOpenCourseWare

    http://ocw.mit.edu

    15.082J / 6.855J / ESD.78J Network OptimizationFall 2010

    For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

    http://ocw.mit.edu/http://ocw.mit.edu/termshttp://ocw.mit.edu/termshttp://ocw.mit.edu/