generators.graph
is a Clojure(Script) library of test.check
generators for graph data.
tools.deps
com.theinternate/generators.graph {:mvn/version "0.0-45"}
Leiningen/Boot
[com.theinternate/generators.graph "0.0-45"]
Maven
<dependency>
<groupId>com.theinternate</groupId>
<artifactId>generators.graph</artifactId>
<version>0.0-45</version>
</dependency>
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 documentation is hosted by cljdoc.
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.