A base interface for walkable collections.
Most algorithms in this library are implemented in terms of walkable collections, which are collections of values that can be traversed incrementally, but there are two types of walkable collections:
- Walkable, which represents nodes without weights.
- WeightedWalkable, which represents nodes with weights.
This interface provides a common base class for both types of walkable collections, allowing algorithms to be implemented in terms of WalkableBase rather than Walkable or WeightedWalkable specifically if they support both types.
Example
// An algorithm that accepts only unweighted walkables.
void acceptsOnlyUnweighted(Walkable<String> graph) {}
// An algorithm that accepts only weighted walkables.
void acceptsOnlyWeighted(WeightedWalkable<String, int> graph) {}
// An algorithm that accepts both unweighted and weighted walkables.
void acceptsBoth(WalkableBase<String> graph) {
acceptsOnlyUnweighted(graph.asUnweighted());
}
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Returns
true
if the walkable collection has no nodes.no setter - isNotEmpty → bool
-
Returns
true
if the walkable collection has one or more nodes.no setter -
roots
→ Iterable<
E> -
Each node that is exposed as a root node of the walkable collection.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
asUnweighted(
) → Walkable< E> - Returns a view of this walkable as an unweighted walkable.
-
containsEdge(
Edge< E> edge) → bool -
Returns whether the collection contains an
edge
connecting two nodes. -
containsRoot(
E node) → bool - Returns whether the collection contains a root node.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
successors(
E node) → Iterable< void> -
Returns each distinct node that is a direct successor of the given
node
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited