Skip to content
elaverman edited this page Nov 20, 2012 · 4 revisions

Analogous to the default vertex implementations, Signal/Collect also provides default implementations for edges. Depending on the specific algorithm these edges can directly be used for constructing a graph or provide some predefined functionality and therefore reduce the functionality that needs to be implemented on top of them when creating a new class that extends them.

Three abstract edge implementations exist (the signal functionality needs to be provided on top of them):

  • DefaultEdge is the default edge implementation and provides the basic structure for linking vertices and sending a signal from the source vertex to the target vertex.
  • OnlySignalOnChangeEdge extends the default edge implementation but keeps track of the last signal sent and only sends a new signal if the current signal differs from it.
  • OptionalSignalEdge extends the default edge implementation but requires the signal function to return an Option[_]- type and sends the contained signal if the return differed from None.

Edges don't necessarily have to be algorithm specific. Sometimes one of the provided concrete edge implementations can be used without any modifications:

The concrete class StateForwarderEdge, which extends the DefaultEdge abstract class, forwards its current state whenever the signal method is invoked by the source vertex.


Previous: Default Vertex Types

Next: Signal/Collect Operations