GridWalkable<E> class final Grids

Adapts a Grid into a WeightedWalkable.

Each node in the grid is automatically connected to its neighbors, based on the configuration provided; the neighbors are connected with the weight that is a tuple of both the source and target node's values.

Example

final grid = ListGrid.fromRows([
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9],
]);

final graph = GridWalkable(grid);
Mixed in types

Constructors

GridWalkable.all8Directions(Grid<E> grid, {double weight(E, E, Pos) = _defaultWeight})
Creates a new lazily built weighted graph from a grid.
factory
GridWalkable.diagonal(Grid<E> grid, {double weight(E, E, Pos) = _defaultWeight})
Creates a new lazily built weighted graph from a grid.
factory
GridWalkable.from(Grid<E> grid, {double weight(E, E, Pos) = _defaultWeight, Iterable<Pos> directions = Direction.cardinal})
Creates a new lazily built weighted graph from a grid.
factory

Properties

edges → Iterable<WeightedEdge<Pos>>
Each edge in the collection.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Returns true if the walkable collection has no nodes.
no setterinherited
isNotEmpty → bool
Returns true if the walkable collection has one or more nodes.
no setterinherited
roots → Iterable<Pos>
Each node that is exposed as a root node of the walkable collection.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

asUnweighted() → Walkable<Pos>
Returns a view of this walkable as an unweighted walkable.
inherited
containsEdge(Edge<Pos> edge) → bool
Returns whether the collection contains an edge connecting two nodes.
inherited
containsRoot(Pos node) → bool
Returns whether the collection contains a root node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
successors(Pos node) → Iterable<(Pos, double)>
Returns each distinct node that is a direct successor of the given node.
override
toString() → String
Returns a string representation of (some of) the nodes of this.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited