directed_graph
1.2.0, released 2 weeks ago by simphotonics.com
Generic directed and weighted directed graph data structures with algorithms for sorting and paths.
WASM-ready
What it does
Provides generic directed, multi, weighted, and bidirected graph structures in Dart. Includes algorithms for topological ordering, shortest and lightest paths, cycles, strongly connected components, and graph crawling.
AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to represent and analyze dependencies or relationships between elements.
- You need to perform topological sorting, find shortest paths, or detect cycles.
- You are working with network connections, file dependencies, or foreign keys.
Skip it when
- You are building data visualizations or charts where a charting package like fl_chart or syncfusion_flutter_charts is more appropriate.
- You only need simple linear lists or standard key-value maps.
Strengths
- Supports multiple graph types including directed, weighted, multi, and bidirected graphs.
- Rich set of built-in graph algorithms like topological ordering and path finding.
- Generic implementation works with any non-nullable object type.
Weaknesses
- Does not include built-in UI components or renderers for visualizing the graphs.
- Mutating large graphs can be computationally intensive depending on the algorithm.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
import 'package:directed_graph/directed_graph.dart';
void main() {
final graph = DirectedGraph<String>({
'a': {'b', 'c'},
'b': {'c'},
});
print(graph.isAcyclic);
}Alternatives
Packages that do the same job and could replace directed_graph.
Works with
Packages commonly used together with directed_graph: ones it builds on, ones built on it, and its own family.
- exception_templatesdirected_graph depends on itGeneric Dart exception and error classes for throwing and catching custom exceptions by type argument.
- lazy_memodirected_graph depends on itCached lazy variables and memoized functions for Dart.
- lakosBuilt on directed_graphVisualize internal Dart library dependencies and detect dependency cycles.
- dart_evalBuilt on directed_graphA flexible Dart bytecode compiler and interpreter for dynamic execution and code push.
- merging_builderBuilt on directed_graphMerges multiple input files into a single output file during the build process.
- infinite_canvasBuilt on directed_graphAn extensible infinite canvas widget for Flutter allowing widgets to be moved, scaled, and connected.