pub repository
mirror.p-hatan.comgraphs
2.3.2Graph algorithms that operate on graphs in any representation.
Readme
CI pub package package publisher
Graph algorithms that do not specify a particular approach for representing a Graph.
Functions in this package will take arguments that provide the mechanism for traversing the graph. For example two common approaches for representing a graph:
class Graph {
Map<Node, List<Node>> nodes;
}
class Node {
// Interesting data
}
class Graph {
Node root;
}
class Node {
List<Node> edges;
// Interesting data
}
Any representation can be adapted to the needs of the algorithm:
- Some algorithms need to associate data with each node in the graph. If the
node type
Tdoes not correctly or efficiently implementhashCodeor==, you may provide optionalequalsand/orhashCodefunctions are parameters. - Algorithms which need to traverse the graph take a
edgesfunction which provides the reachable nodes.(node) => graph[node](node) => node.edges
Graphs that are resolved asynchronously will have similar functions which
return FutureOr.
Changelog
2.3.2
- Require Dart 3.4
- Update to the latest version of
package:dart_flutter_team_lints.
2.3.1
- Update package repository after move.
2.3.0
- Add a
transitiveClosurefunction. - Make
stronglyConnectedComponentsandtopologicalSortiterative rather than recursive to avoid stack overflows on very large graphs. - Require Dart 2.18
2.2.0
- Add a
secondarySortparameter to thetopologicalSort()function which applies an additional lexical sort where that doesn't break the topological sort.
2.1.0
- Add a
topologicalSort()function.
2.0.0
- Breaking:
crawlAsyncwill no longer ignore a node from the graph if thereadNodecallback returns null.
1.0.0
- Migrate to null safety.
- Breaking: Paths from
shortestPath[s]are now returned as iterables to reduce memory consumption of the algorithm to O(n).
0.2.0
- BREAKING
shortestPath,shortestPathsandstronglyConnectedComponentsnow have one generic parameter and have replaced thekeyparameter with optional params:{bool equals(T key1, T key2), int hashCode(T key)}. This follows the pattern used indart:collectionclassesHashMapandLinkedHashMap. It improves the usability and performance of the case where the source values are directly usable in a hash data structure.
0.1.3+1
- Fixed a bug with non-identity
keyinshortestPathandshortestPaths.
0.1.3
- Added
shortestPathandshortestPathsfunctions. - Use
HashMapandHashSetfromdart:collectionforstronglyConnectedComponents. Improves runtime performance.
0.1.2+1
- Allow using non-dev Dart 2 SDK.
0.1.2
crawlAsyncsurfaces exceptions while crawling through the result stream rather than as uncaught asynchronous errors.
0.1.1
crawlAsyncwill now ignore nodes that are resolved tonull.
0.1.0
- Initial release with an implementation of
stronglyConnectedComponentsandcrawlAsync.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add graphspubspec.yaml
name: graphs
version: 2.3.2
description: Graph algorithms that operate on graphs in any representation.
repository: https://github.com/dart-lang/tools/tree/main/pkgs/graphs
environment:
sdk: ^3.4.0
dependencies:
collection: ^1.15.0
dev_dependencies:
dart_flutter_team_lints: ^3.0.0
test: ^1.21.6
# For examples
analyzer: '>=5.2.0 <7.0.0'
path: ^1.8.0
pool: ^1.5.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | 2017-12-07T21:54:39.095368Z | Download | 79e0b059d15c1abd5bedc3455c7327fb94eaa61aab887f68d56e829c907930b4 |
| 0.1.1 | 2018-04-18T22:36:06.834994Z | Download | 54b5858199c56d1193be80732b2b2191c6c96fe254ff6a89b5e1d3687c21654c |
| 0.1.2 | 2018-04-23T22:52:26.777446Z | Download | 208bca8f351d388fc669437bbac63438614f6b69ee3935b539023458e620eebb |
| 0.1.2+1 | 2018-07-18T22:19:08.397060Z | Download | 5a533764d35264f8c201800561296f2e01c545f2ecc71310ede748c304336b4b |
| 0.1.3 | 2018-11-07T21:25:49.444839Z | Download | 0a92d81c10224fc3e86fb1323d4954fafed5c745feaf4da5e92bb2e9fe734924 |
| 0.1.3+1 | 2018-11-08T18:44:59.386434Z | Download | 9735f30b5b42a1d5376654166c0e42210c0de69941614980c0e43221586c65c9 |
| 0.2.0 | 2018-12-12T20:08:31.880263Z | Download | db4e50f399d69bf7349d4e99e8dabd74fad51c0574f36b8d3613ef465715af52 |
| 1.0.0 | 2021-02-26T19:12:28.921128Z | Download | e84da18c5bd9854f4222e62d762e0ffd290726ffc5785dcb976f8c16ff797f5e |
| 2.0.0 | 2021-03-19T16:00:17.175537Z | Download | e07b56af3885387b0cbf6502d4ec17149189559de61256b97e195539afd1da0c |
| 2.1.0 | 2021-09-14T02:11:27.814626Z | Download | ae0b3d956ff324c6f8671f08dcb2dbd71c99cdbf2aa3ca63a14190c47aa6679c |
| 2.2.0 | 2022-10-21T16:53:49.252977Z | Download | f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 |
| 2.3.0 | 2023-05-10T16:18:41.680015Z | Download | 772db3d53d23361d4ffcf5a9bb091cf3ee9b22f2be52cd107cd7a2683a89ba0e |
| 2.3.1 | 2023-05-24T06:39:42.457046Z | Download | aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 |
| 2.3.2 | 2024-07-18T17:05:54.823274Z | Download | 741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0 |
Dependencies
collection "^1.15.0"