| 1 | <?php |
||
| 9 | class Vertex |
||
| 10 | { |
||
| 11 | /** @var mixed Held value */ |
||
| 12 | private $value; |
||
| 13 | |||
| 14 | /** @var Vertex[] */ |
||
| 15 | private $neighbours; |
||
| 16 | |||
| 17 | /** @var int The index in the graph */ |
||
| 18 | private $index = null; |
||
| 19 | |||
| 20 | public function __construct($value, array $neighbours = []) |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return mixed |
||
| 28 | */ |
||
| 29 | public function getValue() |
||
| 33 | |||
| 34 | public function getNeighbours() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param Vertex $neighbour |
||
| 41 | */ |
||
| 42 | public function addNeighbour(Vertex $neighbour) |
||
| 48 | |||
| 49 | public function getIndex() |
||
| 53 | |||
| 54 | public function setIndex($index) |
||
| 58 | } |
||
| 59 |