@@ -3,27 +3,27 @@ discard block |
||
3 | 3 | |
4 | 4 | // Simple relations |
5 | 5 | $relations = [ |
6 | - 1 => [ // point 1 relations |
|
6 | + 1 => [// point 1 relations |
|
7 | 7 | [2, 1], // to point 2 - distance 1 |
8 | 8 | [4, 2], // to point 4 - distance 2 |
9 | 9 | ], |
10 | - 2 => [ // point 2 relations |
|
10 | + 2 => [// point 2 relations |
|
11 | 11 | [1, 1], // to point 1 - distance 1 |
12 | 12 | [3, 3], // to point 3 - distance 3 |
13 | 13 | [4, 3], // to point 4 - distance 3 |
14 | 14 | ], |
15 | - 3 => [ // point 3 relations |
|
15 | + 3 => [// point 3 relations |
|
16 | 16 | [2, 3], // to point 2 - distance 3 |
17 | 17 | [4, 1], // to point 4 - distance 1 |
18 | 18 | [5, 5], // to point 5 - distance 5 |
19 | 19 | ], |
20 | - 4 => [ // point 4 relations |
|
20 | + 4 => [// point 4 relations |
|
21 | 21 | [1, 2], // to point 1 - distance 2 |
22 | 22 | [2, 3], // to point 2 - distance 3 |
23 | 23 | [3, 1], // to point 3 - distance 1 |
24 | 24 | [5, 1], // to point 5 - distance 1 |
25 | 25 | ], |
26 | - 5 => [ // point 5 relations |
|
26 | + 5 => [// point 5 relations |
|
27 | 27 | [3, 5], // to point 3 - distance 5 |
28 | 28 | [4, 1], // to point 4 - distance 1 |
29 | 29 | ], |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | print_r($dijkstra->distances(1)); // all distances from point 1 to other points |
34 | 34 | print_r($dijkstra->generate()); // all distances from all points to all points |
35 | 35 | $relations = [ |
36 | - 1 => [ // point 1 relations |
|
36 | + 1 => [// point 1 relations |
|
37 | 37 | [2, 1], // to point 2 - distance 1 |
38 | 38 | ], |
39 | - 2 => [ // point 2 relations |
|
39 | + 2 => [// point 2 relations |
|
40 | 40 | [3, 1], // to point 3 - distance 1 |
41 | 41 | ], |
42 | - 3 => [ // point 3 relations |
|
42 | + 3 => [// point 3 relations |
|
43 | 43 | [1, 1], // to point 1 - distance 1 |
44 | 44 | ], |
45 | - 4 => [ // point 4 relations |
|
45 | + 4 => [// point 4 relations |
|
46 | 46 | [5, 1], // to point 5 - distance 1 |
47 | 47 | ], |
48 | - 5 => [ // point 5 relations |
|
48 | + 5 => [// point 5 relations |
|
49 | 49 | [4, 1], // to point 5 - distance 1 |
50 | 50 | ], |
51 | 51 | ]; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | var_dump($dijkstra->generate()); // all distances from all points to all points |
56 | 56 | |
57 | 57 | // Or set this relations in another way |
58 | -$dijkstra = new Algorithms\Dijkstra(function (Algorithms\Dijkstra\Creator $creator) { |
|
58 | +$dijkstra = new Algorithms\Dijkstra(function(Algorithms\Dijkstra\Creator $creator) { |
|
59 | 59 | $creator->addPoint(1) |
60 | 60 | ->addRelation(2, 1); |
61 | 61 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | var_dump($dijkstra->generate()); |
76 | 76 | |
77 | 77 | // You can also add points like that |
78 | -new Algorithms\Dijkstra(function (Algorithms\Dijkstra\Creator $creator) { |
|
78 | +new Algorithms\Dijkstra(function(Algorithms\Dijkstra\Creator $creator) { |
|
79 | 79 | $point = $creator->addPoint(1) |
80 | 80 | ->addRelation(2, 5); |
81 | 81 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | try { |
30 | 30 | return $this->getPointOrFail($point_id); |
31 | - } catch(PointException $e) { |
|
31 | + } catch (PointException $e) { |
|
32 | 32 | return NULL; |
33 | 33 | } |
34 | 34 | } |