graph_collection 1.1.2
Provides numerous graph theory based Graph Collections
Graph theory #
Graph theory is the study of graphs, which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of vertices (also called nodes or points) which are connected by edges (also called links or lines).
Undirected Graph #
UndirectedGraph
All edges of the undirected graph are bidirectional
Directed Graph #
DirectedGraph
All edges of the directed graph are directed from one vertex to another
Link Graph #
LinkGraph
Union of directed graphs and undirected graphs
This means that only edge relationships can be stored and values cannot be stored.
Multigraph #
A multigraph (in contrast to a simple graph) is a graph which is permitted to have multiple edges (also called parallel edges[1]), that is, edges that have the same end nodes. Thus two vertices may be connected by more than one edge.
The base implementation of this library is part of the multigraph
It allows each key
to produce an edge, but does not allow 2 key
equal edges
Each key
can represent an edge between two nodes that store values
It is like allowing red and blue edges to exist together but not allowing 2 red or 2 blue
Undirected Value Graph #
UndirectedValueGraph
An undirected graph of values can be set
Directed Value Graph #
DirectedValueGraph
An directed graph of values can be set
Graph #
Graph
Union of directed graphs, undirected graphs, directed value graphs, undirected value graphs
API reference #
Example #
import 'package:graph_collection/graph.dart';
void main() {
final g = Graph();
// Base
g.add(1);
g.has(1);
g.remove(1);
// Undirected Graph
g.link(1, 2);
g.hasLink(1, 2);
g.unLink(1, 2);
// Directed Graph
g.linkTo(1, 2);
g.hasLinkTo(1, 2);
g.unLinkTo(1, 2);
// Undirected value Graph
g.set(1, 2, 3, 4);
g.hasEdge(1, 2, 3);
g.get(1, 2, 3);
g.unSet(1, 2, 3);
g.setBy<int>(1, 2, 3);
g.hasEdgeBy<int>(1, 2);
g.getBy<int>(1, 2);
g.unSetBy<int>(1, 2);
// Directed value Graph
g.setTo(1, 2, 3, 4);
g.hasEdgeTo(1, 2, 3);
g.get(1, 2, 3);
g.unSetTo(1, 2, 3);
g.setToBy<int>(1, 2, 3);
g.hasEdgeToBy<int>(1, 2);
g.getBy<int>(1, 2);
g.unSetToBy<int>(1, 2);
}
1.1.2 #
Improve score
1.1.1 #
Improve score
1.1.0 #
Add edge tags
1.0.0 #
Base
import 'package:graph_collection/graph.dart';
void main() {
final g = Graph();
// Base
g.add(1);
g.has(1);
g.remove(1);
// Undirected Graph
g.link(1, 2);
g.hasLink(1, 2);
g.unLink(1, 2);
// Directed Graph
g.linkTo(1, 2);
g.hasLinkTo(1, 2);
g.unLinkTo(1, 2);
// Undirected value Graph
g.set(1, 2, 3, 4);
g.hasEdge(1, 2, 3);
g.get(1, 2, 3);
g.unSet(1, 2, 3);
g.setBy<int>(1, 2, 3);
g.hasEdgeBy<int>(1, 2);
g.getBy<int>(1, 2);
g.unSetBy<int>(1, 2);
// Directed value Graph
g.setTo(1, 2, 3, 4);
g.hasEdgeTo(1, 2, 3);
g.get(1, 2, 3);
g.unSetTo(1, 2, 3);
g.setToBy<int>(1, 2, 3);
g.hasEdgeToBy<int>(1, 2);
g.getBy<int>(1, 2);
g.unSetToBy<int>(1, 2);
}
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies:
graph_collection: ^1.1.2
2. Install it
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter pub get
Alternatively, your editor might support pub get
or flutter pub get
.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
import 'package:graph_collection/graph.dart';
Popularity:
Describes how popular the package is relative to other packages.
[more]

22

Health:
Code health derived from static analysis.
[more]

100

Maintenance:
Reflects how tidy and uptodate the package is.
[more]

100

Overall:
Weighted score of the above.
[more]

61

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
 Dart: 2.7.0
 pana: 0.13.4
Health suggestions
Format lib/graph.dart
.
Run dartfmt
to format lib/graph.dart
.
Format lib/src/graphs/directed.dart
.
Run dartfmt
to format lib/src/graphs/directed.dart
.
Format lib/src/graphs/directed.value.dart
.
Run dartfmt
to format lib/src/graphs/directed.value.dart
.
Fix additional 4 files with analysis or formatting issues.
Additional issues in the following files:
lib/src/graphs/get.dart
(Rundartfmt
to formatlib/src/graphs/get.dart
.)lib/src/graphs/items.dart
(Rundartfmt
to formatlib/src/graphs/items.dart
.)lib/src/graphs/undirected.dart
(Rundartfmt
to formatlib/src/graphs/undirected.dart
.)lib/src/graphs/undirected.value.dart
(Rundartfmt
to formatlib/src/graphs/undirected.value.dart
.)