Skip to content
pubscout

graphs

2.3.2, released 2 years ago by tools.dart.dev

Graph algorithms that operate on graphs in any representation.

WASM-readyQuiet but busy
$ flutter pub add graphs
Source repository

What it does

Provides generic graph algorithms like topological sort, strongly connected components, transitive closure, and shortest paths. Functions accept custom edge-traversal mechanisms so they work with any data structure representing your graph.

AI-written summary of version 2.3.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to run graph algorithms like topological sort or shortest path on custom data structures
  • You want to traverse graphs asynchronously or synchronously without locking into a specific graph schema

Skip it when

  • You need a complete UI charting library or visual graph rendering solution
  • You are looking for state management or dependency injection tools

Strengths

  • Independent of any specific graph data representation
  • Supports both synchronous and asynchronous graph resolution
  • Includes iterative algorithms to avoid stack overflows on very large graphs

Weaknesses

  • Does not include UI widgets or visual graph rendering capabilities
  • Does not provide a built-in graph data structure class out of the box

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
class Graph {
  Map<Node, List<Node>> nodes;
}
class Node {
  // Interesting data
}

// Use traversal functions with custom edges callback:
// topologicalSort(nodes, edges: (node) => graph[node]);

Works with

Packages commonly used together with graphs: ones it builds on, ones built on it, and its own family.