RelaxableVertex

com.phasmidsoftware.gryphon.core.RelaxableVertex
See theRelaxableVertex companion object
case class RelaxableVertex[V, R](attribute: V, adjacencies: Adjacencies[V])(var maybeR: Option[R] = ...)(using evidence$1: Ordering[R]) extends AbstractVertex[V], Ordered[RelaxableVertex[V, R]]

A vertex that additionally carries an optional relaxable property maybeR, used in Dijkstra-style shortest-path algorithms.

The discovered flag has been removed; only the relaxable property maybeR is retained as mutable state (Dijkstra relaxation requires in-place update semantics on the vertex).

Type parameters

R

the type of the relaxable property; must have an Ordering.

V

the type of the vertex attribute.

Value parameters

adjacencies

the collection of adjacencies.

attribute

the data associated with this vertex.

maybeR

the current best-known cost to reach this vertex, if set.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Ordered[RelaxableVertex[V, R]]
trait Comparable[RelaxableVertex[V, R]]
class AbstractVertex[V]
trait Vertex[V]
trait Attribute[V]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def compare(that: RelaxableVertex[V, R]): Int

Result of comparing this with operand that.

Result of comparing this with operand that.

Implement this method to determine how instances of A will be sorted.

Returns x where:

  • x < 0 when this < that

  • x == 0 when this == that

  • x > 0 when this > that

Value parameters

that

the instance to compare against

Attributes

Returns

an integer whose sign indicates the ordering relation between this and that

def relax(r: R): RelaxableVertex[V, R]

Updates maybeR to r if r is smaller than the current value (or if unset).

Updates maybeR to r if r is smaller than the current value (or if unset).

Value parameters

r

the candidate relaxation value.

Attributes

Returns

this vertex (mutated in place) if relaxed, otherwise this vertex unchanged.

def render: String

Renders the vertex as a human-readable string.

Renders the vertex as a human-readable string.

Attributes

Returns

a string representation of the vertex.

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def unit(adjacencies: Adjacencies[V]): RelaxableVertex[V, R]

Constructs a new instance of this vertex type with the given adjacencies, preserving all other fields.

Constructs a new instance of this vertex type with the given adjacencies, preserving all other fields.

Value parameters

adjacencies

the updated adjacency collection.

Attributes

Returns

a new vertex of the same concrete type.

Inherited methods

def +(a: Adjacency[V]): AbstractVertex[V]

Adds an adjacency, delegating construction to unit.

Adds an adjacency, delegating construction to unit.

Attributes

Inherited from:
AbstractVertex
def <(that: RelaxableVertex[V, R]): Boolean

Returns true if this is less than that

Returns true if this is less than that

Value parameters

that

the instance to compare against

Attributes

Inherited from:
Ordered
def <=(that: RelaxableVertex[V, R]): Boolean

Returns true if this is less than or equal to that.

Returns true if this is less than or equal to that.

Attributes

Inherited from:
Ordered
def >(that: RelaxableVertex[V, R]): Boolean

Returns true if this is greater than that.

Returns true if this is greater than that.

Value parameters

that

the instance to compare against

Attributes

Inherited from:
Ordered
def >=(that: RelaxableVertex[V, R]): Boolean

Returns true if this is greater than or equal to that.

Returns true if this is greater than or equal to that.

Attributes

Inherited from:
Ordered
def compareTo(that: RelaxableVertex[V, R]): Int

Result of comparing this with operand that.

Result of comparing this with operand that.

Value parameters

that

the instance to compare against

Attributes

Inherited from:
Ordered
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product

Concrete fields

var maybeR: Option[R]