Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nwjsmith/generators.graph
A library of test.check generators for graph data
https://github.com/nwjsmith/generators.graph
clojure clojure-spec graph graphs property-based-testing test-check
Last synced: 8 days ago
JSON representation
A library of test.check generators for graph data
- Host: GitHub
- URL: https://github.com/nwjsmith/generators.graph
- Owner: nwjsmith
- License: apache-2.0
- Created: 2018-04-17T14:38:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-29T02:51:31.000Z (over 3 years ago)
- Last Synced: 2025-02-04T04:31:34.289Z (10 days ago)
- Topics: clojure, clojure-spec, graph, graphs, property-based-testing, test-check
- Language: Clojure
- Homepage:
- Size: 95.7 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# generators.graph
[![GitHub Actions badge](https://github.com/nwjsmith/generators.graph/workflows/Test/badge.svg)](https://github.com/nwjsmith/generators.graph/actions?query=workflow%3ATest+branch%3Amaster) [![cljdoc badge](https://cljdoc.org/badge/com.theinternate/generators.graph)](https://cljdoc.org/d/com.theinternate/generators.graph) [![Clojars Project](https://img.shields.io/clojars/v/com.theinternate/generators.graph.svg)](https://clojars.org/com.theinternate/generators.graph) [![Codecov badge](https://codecov.io/gh/nwjsmith/generators.graph/branch/master/graph/badge.svg)](https://codecov.io/gh/nwjsmith/generators.graph)
`generators.graph` is a Clojure(Script) library of [`test.check`](https://github.com/clojure/test.check) generators for graph data.
## Install
**tools.deps**
```clojure
com.theinternate/generators.graph {:mvn/version "0.0-45"}
```**Leiningen/Boot**
```clojure
[com.theinternate/generators.graph "0.0-45"]
```**Maven**
```xml
com.theinternate
generators.graph
0.0-45```
## Usage
Fire up a REPL and try it out!
```clojure
(require '[clojure.test.check.generators :as gen])
(require '[com.theinternate.generators.graph :as gen.graph])
```Generate a random DAG from a set of nodes:
```clojure
(gen/generate (gen.graph/gen-directed-acyclic-graph #{:a :b :c :d}))
```Generate a random topological ordering of a DAG:
```clojure
(gen/generate (gen.graph/gen-topological-ordering {:a #{}
:b #{}
:c #{:b :d}
:d #{:a}}))
```Generate a pruned subgraph of a DAG:
```clojure
(gen/generate (gen.graph/gen-pruned-directed-acyclic-graph {:a #{}
:b #{:a}
:c #{:b :d :a}
:d #{:b :a}
:e #{:c :b :a}}))
```## API reference
[API reference documentation](https://cljdoc.org/d/com.theinternate/generators.graph/CURRENT) is hosted by [cljdoc](https://cljdoc.org).
## Maintainer
[Nate Smith](http://theinternate.com)
## License
Copyright © 2019 Nathaniel Smith
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
```
http://www.apache.org/licenses/LICENSE-2.0
```Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.