Giraph Travelling Salesman Example

26
23 12 33 0 23 12 33 1 2 24 32 31 3 24 32 31 Giraph : Travelling Salesman Problem 10 30 1 0 On the left, we will show the original graph, to know how to process each step
  • date post

    18-Oct-2014
  • Category

    Technology

  • view

    2.114
  • download

    6

description

Quick brute-force implementation of the Travelling Salesman Problem with Giraph

Transcript of Giraph Travelling Salesman Example

Page 1: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1 2

24

32

31

3

24

32

31

Giraph : Travelling Salesman Problem

10

30

1

0

On the left, we will show the original graph, to know how to process each step

Page 2: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1 2

24

32

31

3

24

32

31

Giraph : Travelling Salesman Problem

10

30

1

0

Superstep 0 begins

Page 3: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1 2

24

32

31

3

24

32

31

Giraph : Travelling Salesman Problem

10

30

1

Superstep 0 : we compute vertex n°1, nothing to do, it is not the source

Page 4: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1 2

24

32

31

3

24

32

31

Giraph : Travelling Salesman Problem

10

30

1

Superstep 0 : we compute vertex n°2, the source

Page 5: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1 2

24

32

31

3

24

32

31

2,12+1

Giraph : Travelling Salesman Problem

10

30

1

Superstep :

2,12+30

The source sends all the possible paths and their values to the others nodes

Page 6: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1 2

24

32

31

3

24

32

31

2,12+1

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

The source then votes to halt

Page 7: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1 2

24

32

31

3

24

32

31

2,12+1

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

Superstep 0 : we compute vertex n°3, nothing happens as it is not the source

Page 8: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

24

32

31

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

Superstep 1 begins

Page 9: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

24

32

31

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

Superstep 1 : we compute vertex n°1

Page 10: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

24

32

31

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

21,42+10+23

12 12

Superstep 1 : we compute vertex n°1

Page 11: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

24

32

31

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

21,42+10+23

Superstep 1 : we compute vertex n°3

Page 12: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

24

32

31

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

Superstep 1 : we compute vertex n°3

Page 13: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

Superstep 2 begins

12

Page 14: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

Superstep 2 : we compute vertex n°1

12

Page 15: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

Superstep 2 : we compute vertex n°1

12

Page 16: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

Superstep 2 : we compute vertex n°3

12

Page 17: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

24

32

31

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

Superstep 2 : we compute vertex n°3

12

Page 18: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

12

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

12

Superstep 3 begins

12

Page 19: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

12

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

12

Superstep 3 : we compute vertex n°1

12

Page 20: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

12

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

12

23

Superstep 3 : we compute vertex n°1 : votes to Halt

12

Page 21: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

12

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

12

23

Superstep 3 : we compute the source, reactivated by the messages received

12

Page 22: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

12

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

23

The source compares the values received and finds the minimum distance

12

Page 23: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

109

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

23

and sets its value as the minimum

12

Page 24: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

109

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

23

109

The source then votes to Halt

12

Page 25: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

109

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

23

109

Superstep 3 : we compute vertex n°3

12

Page 26: Giraph Travelling Salesman Example

23

12

33

0

23

12

33

1

23

33

2

23

33

3

23

109

33

2,12+1

12

Giraph : Travelling Salesman Problem

10

30

1

2,12+30

12 12

23,13+10+33

21,42+10+23

231,56+30+23=109

213,75+10+33=118

23

109

33

Superstep 3 : we compute vertex n°3 : votes to Halt, ends the process

12