class Vertex implements VertexInterface (View source)

Properties

protected $id
protected $potential
protected $potentialFrom
protected $connections
protected $passed

Methods

__construct(mixed $id)

Instantiates a new vertex, requiring a ID to avoid collisions.

connect(VertexInterface $vertex, integer $distance = 1)

Connects the vertex to another $vertex.

Array
getConnections()

Returns the connections of the current vertex.

mixed
getId()

Returns the identifier of this vertex.

integer
getPotential()

Returns vertex's potential.

getPotentialFrom()

Returns the vertex which gave to the current vertex its potential.

boolean
isPassed()

Returns whether the vertex has passed or not.

markPassed()

Marks this vertex as passed, meaning that, in the scope of a graph, he has already been processed in order to calculate its potential.

boolean
setPotential(integer $potential, VertexInterface $from)

Sets the potential for the vertex, if the vertex has no potential or the one it has is higher than the new one.

Details

__construct(mixed $id)

Instantiates a new vertex, requiring a ID to avoid collisions.

Parameters

mixed $id

connect(VertexInterface $vertex, integer $distance = 1)

Connects the vertex to another $vertex.

A $distance, to balance the connection, can be specified.

Parameters

VertexInterface $vertex
integer $distance

Array getConnections()

Returns the connections of the current vertex.

Return Value

Array

mixed getId()

Returns the identifier of this vertex.

Return Value

mixed

integer getPotential()

Returns vertex's potential.

Return Value

integer

Vertex getPotentialFrom()

Returns the vertex which gave to the current vertex its potential.

Return Value

Vertex

boolean isPassed()

Returns whether the vertex has passed or not.

Return Value

boolean

markPassed()

Marks this vertex as passed, meaning that, in the scope of a graph, he has already been processed in order to calculate its potential.

boolean setPotential(integer $potential, VertexInterface $from)

Sets the potential for the vertex, if the vertex has no potential or the one it has is higher than the new one.

Parameters

integer $potential
VertexInterface $from

Return Value

boolean