# Dijkstra

class
**Dijkstra** implements
AlgorithmInterface (View source)

## Properties

protected | $startingVertex | ||

protected | $endingVertex | ||

protected | $graph | ||

protected | $paths | ||

protected | $solution |

## Methods

Returns the distance between the starting and the ending point.

Gets the vertex which we are pointing to.

Returns the solution in a human-readable style.

Reverse-calculates the shortest path of the graph thanks the potentials stored in the vertices.

Retrieves the vertex which we are starting from to calculate the shortest path.

Sets the vertex which we are starting from to calculate the shortest path.

Solves the algorithm and returns all possible results.

Recursively calculates the potentials of the graph, from the starting point you specify with ->setStartingVertex(), traversing the graph due to Vertex's $connections attribute.

Returns the graph associated with this algorithm instance.

Returns the possible paths registered in the graph.

Checks wheter the current algorithm has been solved or not.

## Details

###
at line 41
```
```**__construct**(GraphInterface $graph)

**__construct**(GraphInterface $graph)

Instantiates a new algorithm, requiring a graph to work with.

###
at line 51
```
integer
```**getDistance**()

**getDistance**()

Returns the distance between the starting and the ending point.

###
at line 67
```
VertexInterface
```**getEndingVertex**()

**getEndingVertex**()

Gets the vertex which we are pointing to.

###
at line 77
```
string
```**getLiteralShortestPath**()

**getLiteralShortestPath**()

Returns the solution in a human-readable style.

###
at line 95
```
Array
```**getShortestPath**()

**getShortestPath**()

Reverse-calculates the shortest path of the graph thanks the potentials stored in the vertices.

###
at line 115
```
VertexInterface
```**getStartingVertex**()

**getStartingVertex**()

Retrieves the vertex which we are starting from to calculate the shortest path.

###
at line 125
```
```**setEndingVertex**(VertexInterface $vertex)

**setEndingVertex**(VertexInterface $vertex)

Sets the vertex which we are pointing to.

###
at line 135
```
```**setStartingVertex**(VertexInterface $vertex)

**setStartingVertex**(VertexInterface $vertex)

Sets the vertex which we are starting from to calculate the shortest path.

###
at line 144
```
mixed
```**solve**()

**solve**()

Solves the algorithm and returns all possible results.

###
at line 163
```
protected
```**calculatePotentials**(VertexInterface $vertex)

**calculatePotentials**(VertexInterface $vertex)

Recursively calculates the potentials of the graph, from the starting point you specify with ->setStartingVertex(), traversing the graph due to Vertex's $connections attribute.

###
at line 201
```
protected GraphInterface
```**getGraph**()

**getGraph**()

Returns the graph associated with this algorithm instance.

###
at line 211
```
protected Array
```**getPaths**()

**getPaths**()

Returns the possible paths registered in the graph.

###
at line 221
```
protected boolean
```**isSolved**()

**isSolved**()

Checks wheter the current algorithm has been solved or not.