GraphFactory<V, E> class

Factory methods to create common graph types efficiently.

Available extensions

Constructors

GraphFactory({bool isDirected = true, bool isUnmodifiable = false, V vertexProvider(int index)?, E edgeProvider(V source, V target)?, Random? random, StorageStrategy<V>? vertexStrategy})

Properties

atlasLength → int

Available on GraphFactory<V, E>, provided by the AtlasGraphFactoryExtension extension

Returns the number of graphs in the Atlas of Graphs (1253).
no setter
edgeProvider → E Function(V source, V target)?
Optional provider of edge data.
final
hashCode → int
The hash code for this object.
no setterinherited
isDirected → bool
Flag indicating if the graph is directed.
final
isUnmodifiable → bool
Flag indicating if the resulting graph can be further modified.
final
random → Random
Random generator used when creating random graphs.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
vertexProvider → V Function(int index)?
Optional provider of vertex data.
final
vertexStrategy → StorageStrategy<V>
The strategy describing how vertices are stored.
final

Methods

atlas(int number) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the AtlasGraphFactoryExtension extension

Returns a graph from "An Atlas of Graphs" by Ronald C. Read and Robin J. Wilson, Oxford University Press, 1998.
atlasMatching({int? vertexCount, int? edgeCount}) → Iterable<Graph<V, E>>

Available on GraphFactory<V, E>, provided by the AtlasGraphFactoryExtension extension

Returns an iterable over all the graphs in the atlas with the provided vertexCount (from 0 to 7) and edgeCount (from 0 to 21), see atlas for details.
complete({required int vertexCount}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the CompleteGraphFactoryExtension extension

Creates a complete Graph where all vertices are connected with each other.
completeTree({required int vertexCount, int arity = 2}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the TreeGraphFactoryExtension extension

Creates a complete tree with vertexCount nodes and a branching factor of arity. By definition it is completely filled on every level except for the last one; where all the nodes are as far left as possible.
empty() → Graph<V, E>

Available on GraphFactory<V, E>, provided by the EmptyGraphFactoryExtension extension

Creates an empty graph.
fromMermaid(String source, {V vertexParser(String id, String? label)?, E edgeParser(String? label)?}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the MermaidGraphFactoryExtension extension

Creates a Graph parsed from a Mermaid flowchart definition.
fromPath(Iterable<V> chain, {E? value}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the CollectionGraphFactoryExtension extension

Creates a Graph from a Iterable of chains.
fromPaths(Iterable<Iterable<V>> chains, {E? value}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the CollectionGraphFactoryExtension extension

Creates a Graph from a Iterable of chains.
fromPredecessorFunction(Iterable<V> vertices, Iterable<V> predecessors(V vertex)) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the CollectionGraphFactoryExtension extension

Creates a Graph from start vertices and a function predecessors returning its preceding vertices (incoming adjacency).
fromPredecessors(Map<V, Iterable<V>?> mapping) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the CollectionGraphFactoryExtension extension

Creates a Graph from a Map of vertices pointing to an Iterable of preceding vertices (incoming adjacency).
fromSuccessorFunction(Iterable<V> vertices, Iterable<V> successors(V vertex)) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the CollectionGraphFactoryExtension extension

Creates a Graph from start vertices and a function successors returning its succeeding vertices (outgoing adjacency).
fromSuccessors(Map<V, Iterable<V>?> mapping) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the CollectionGraphFactoryExtension extension

Creates a Graph from a Map of vertices pointing to an Iterable of succeeding vertices (outgoing adjacency).
grid({required int rows, required int columns}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the GridGraphFactoryExtension extension

Creates a Graph of rows by columns in a rectangular 2D grid.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
partite({required Iterable<int> vertexCounts}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the PartiteGraphFactoryExtension extension

Creates a partite Graph with a number of vertices on each layer.
path({required int vertexCount}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the PathGraphFactoryExtension extension

Creates a Graph that forms a linear path.
perfectTree({required int height, int arity = 2}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the TreeGraphFactoryExtension extension

Creates a perfectly balanced tree of height and a branching factor of arity. In the resulting tree all leaf nodes are at the same depth.
randomErdosRenyi({required int vertexCount, required double probability}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the RandomGraphFactoryExtension extension

Generates a graph using the Erdős–Rényi model with vertexCount vertices and a constant probability of creating an edge between any pair of vertices.
ring({required int vertexCount}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the RingGraphFactoryExtension extension

Creates a Graph that forms a closed ring.
star({required int vertexCount}) → Graph<V, E>

Available on GraphFactory<V, E>, provided by the StarGraphFactoryExtension extension

Creates a Graph that forms a star.
toString() → String
A string representation of this object.
inherited

Operators

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