https://github.com/andimiller/hedgehogs
A graph traversal library for cyclic graphs with weighted edges
https://github.com/andimiller/hedgehogs
Last synced: about 1 month ago
JSON representation
A graph traversal library for cyclic graphs with weighted edges
- Host: GitHub
- URL: https://github.com/andimiller/hedgehogs
- Owner: andimiller
- License: mit
- Created: 2022-05-10T11:51:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-19T20:22:35.000Z (2 months ago)
- Last Synced: 2025-03-28T21:51:08.402Z (2 months ago)
- Language: Scala
- Size: 154 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hedgehogs
A generic Graph library for Scala.
Scala Versions: 2.13, 3
Scala Targets: JVM, JS# Core
## `SimpleGraph[Id]`
* Models a graph with directed edges
* `inbound` and `outbound` methods for any node## `DataGraph[Id, NodeData, EdgeData]`
* Models a graph with directed edges, and can hold data in the nodes and edges
* `inbound` and `outbound` methods for any node## `Dijkstra`
* Supports routefinding across any `SimpleGraph` or `DataGraph`
* Supports finding multiple routes at once with `multi` variant## `Dag`
* `validate` - check if any `SimpleGraph` or `DataGraph` is a Directed Acyclic Graph, flags any nodes with cycles
* `isDag` - checks if a graph is a DAG, returns a Boolean## `Connectivity`
* `countDisconnectedSubgraphs` - checks how many disconnected subgraphs are in a graph
# Mermaid
## `flowchart`
* Can render any `DataGraph` which is a DAG into a mermaid graph
# Dag Visitor
## `DagVisitor[F[_], Id, InputNodeData, OutputNodeData, EdgeData]`
* Interface which can be implemented to describe how to run a `DataGraph`
## `DagVisitor.runConcurrent`
* Runs a `DagVisitor` against a compatible `DataGraph`
* Runs concurrently, starts nodes as soon as they can be run
* Can run different `RunMode`s, indicating the direction edges run
* `Flow` will make `A->B` run `A` then `B`, this is the default
* `Dependency` will make `A->B` run `B` then `A`