Package com.phasmidsoftware.visitor.java
Interface NeighbourFunction<H,V>
- Type Parameters:
H- the node type whose neighbours are being requestedV- the neighbour type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplies the neighbours (or children) of a node.
This is the Java-facing form of Visitor's Neighbours[H, V] type class: it is the
"how do we traverse" concern, completely decoupled from the domain. For an ordinary graph the
two type parameters are the same, so a homogeneous adjacency is a
NeighbourFunction<V, V>. They differ only for a tree whose root has a different type
from its descendants — see
Traversals.traverseTree(Object, NeighbourFunction, NeighbourFunction, Order).
The returned Iterable may be empty but must not be null. Its order is the
order in which neighbours are offered to the traversal frontier, so it determines tie-breaking
between equally eligible neighbours.
-
Method Summary
-
Method Details
-
neighbours
Returns the neighbours ofnode.- Parameters:
node- the node whose neighbours are wanted- Returns:
- the neighbours, possibly empty, never
null
-