A graph where edges have an associated weight, or "cost", a double value.
The weight of an edge is a value associated with the edge that can be used to determine the cost of traversing the edge, or to determine the shortest path between two nodes.
A graph can be either directed, i.e. an edge has a source and a target node, or undirected, where there is no such distinction, but most algorithms and operations are applicable to both types of graphs.
- Implemented types
Constructors
Properties
-
edges
→ Iterable<
WeightedEdge< V> > -
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<
V> -
Each node that is exposed as a root node of the walkable collection.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addEdge(
WeightedGraph< V> edge) → double? -
Adds an
edge
fromsource
totarget
with aweight
to the graph. -
addEdges(
Iterable< WeightedEdge< edges) → voidV> > - Adds multiple edges to the graph.
-
asUnweighted(
) → Walkable< V> -
Returns a view of this walkable as an unweighted walkable.
inherited
-
clear(
) → void - Clears the graph of all nodes and edges.
-
containsEdge(
Edge< V> edge) → bool -
Returns whether the collection contains an
edge
connecting two nodes.inherited -
containsRoot(
V node) → bool -
Returns whether the collection contains a root node.
inherited
-
getEdge(
Edge< V> edge) → double? -
Returns the value at
edge
ornull
if it does not exist. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeEdge(
Edge< V> edge) → double? -
Removes an
edge
fromsource
totarget
with aweight
to the graph. -
successors(
V node) → Iterable< (V, double)> -
Returns each distinct node that is a direct successor of the given
node
.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited