Giter Club home page Giter Club logo

graphdart's Introduction

Provides numerous graph theory based Graph Collections

pub MIT

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 Directed

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.
Multigraph

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

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.tryGet(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.tryGetBy<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.tryGet(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.tryGetBy<int>(1, 2);
  g.unSetToBy<int>(1, 2);
}

graphdart's People

Contributors

2a5f avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

graphdart's Issues

How to use this with flutter

Do you know how I can use this with flutter?
I want directed graph in my flutter app.
But I dont know how to use the library.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/dart.yml
  • actions/checkout v3
pub
pubspec.yaml
  • some ^2.0.0
  • test ^1.19.0
  • dart >=2.14.0 <3.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.