Graph<V, E> class abstract

Abstract base class of graphs.

Graph does not support parallel edges. If you re-add an edge with the same source and target vertex the previous edge is replaced with the new one. Use an Iterable as the edge-value, if you'd like to model a graph with parallel edges.

Graph allows self-loops (edges from a vertex to itself). If you do not want self-loops, do not create self-loops.

Mixed in types
Implementers
Available Extensions

Constructors

Graph()
Generative constructor.
Graph.directed({StorageStrategy<V>? vertexStrategy})
Constructs a directed graph.
factory
Graph.undirected({StorageStrategy<V>? vertexStrategy})
Constructs an undirected graph.
factory

Properties

defaultToStringPrinter ObjectPrinter
Override to configure the empty ObjectPrinter.
no setterinherited
edges Iterable<Edge<V, E>>
Returns the edges of this graph.
no setter
hashCode int
The hash code for this object.
no setterinherited
isDirected bool
Returns true, if the graph is directed.
no setter
isUnmodifiable bool
Returns true, if the graph is unmodifiable.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toStringPrinter ObjectPrinter
Override and call super to add values to the ObjectPrinter.
no setteroverride
vertexStrategy StorageStrategy<V>
Returns a strategy to store vertices.
no setter
vertices Iterable<V>
Returns the vertices of this graph.
no setter

Methods

addEdge(V source, V target, {E? value}) → void
Adds an edge between source and target vertex. Optionally associates the provided value with the edge. If the edge already exists, replaces the existing edge data.
addVertex(V vertex) → void
Adds a vertex to this graph.
edgesOf(V vertex) Iterable<Edge<V, E>>
Returns the incoming and outgoing edges of vertex.
getEdge(V source, V target) Edge<V, E>?
Returns the edge between source and target, or null.
incomingEdgesOf(V vertex) Iterable<Edge<V, E>>
Returns the incoming edges of vertex.
neighboursOf(V vertex) Iterable<V>
Returns the vertices that are adjacent to a vertex.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outgoingEdgesOf(V vertex) Iterable<Edge<V, E>>
Returns the outgoing edges of vertex.
predecessorsOf(V vertex) Iterable<V>
Returns the vertices that come before a vertex.
putEdge(V source, V target, E ifAbsent()) → E
Look up the value of the edge between source and target, or add a new edge with the value of ifAbsent if it isn't there.
removeEdge(V source, V target) → void
Removes an edge between source and target from this graph.
removeVertex(V vertex) → void
Removes a vertex from this graph.
successorsOf(V vertex) Iterable<V>
Returns the vertices that come after a vertex.
toString() String
Standard toString implementation. Do not override, instead implement toStringPrinter to customize.
inherited

Operators

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