Skip to content
A library of test.check generators for graph data
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
bin
src/com/theinternate/generators
test/com/theinternate/generators
.gitignore
CHANGELOG.md
LICENSE
README.md
deps.edn
package-lock.json
pom.xml
tests.edn

README.md

generators.graph

CircleCI cljdoc badge Clojars Project codecov

generators.graph is a Clojure(Script) library of test.check generators for graph data.

Install

tools.deps

com.theinternate/generators.graph {:mvn/version "0.0-41"}

Leiningen/Boot

[com.theinternate/generators.graph "0.0-41"]

Maven

<dependency>
  <groupId>com.theinternate</groupId>
  <artifactId>generators.graph</artifactId>
  <version>0.0-41</version>
</dependency>

Usage

Fire up a REPL and try it out!

(require '[clojure.test.check.generators :as gen])
(require '[com.theinternate.generators.graph :as gen.graph])

Generate a random DAG from a set of nodes:

(gen/generate (gen.graph/gen-directed-acyclic-graph #{:a :b :c :d}))

Generate a random topological ordering of a DAG:

(gen/generate (gen.graph/gen-topological-ordering {:a #{}
                                                   :b #{}
                                                   :c #{:b :d}
                                                   :d #{:a}}))

Generate a pruned subgraph of a DAG:

(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 is hosted by cljdoc.

Maintainer

Nate Smith

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.

You can’t perform that action at this time.