https://github.com/egri-nagy/orbit
Generic orbit and graph search algorithms in Clojure.
https://github.com/egri-nagy/orbit
clojure computer-algebra orbit search-algorithm
Last synced: 7 months ago
JSON representation
Generic orbit and graph search algorithms in Clojure.
- Host: GitHub
- URL: https://github.com/egri-nagy/orbit
- Owner: egri-nagy
- License: gpl-3.0
- Created: 2017-06-03T02:24:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-06-03T09:13:50.000Z (8 months ago)
- Last Synced: 2025-06-03T19:17:45.007Z (8 months ago)
- Topics: clojure, computer-algebra, orbit, search-algorithm
- Language: Clojure
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://clojars.org/orbit)
[](https://travis-ci.org/egri-nagy/orbit)
[](https://cljdoc.org/d/orbit/orbit/CURRENT)
# orbit
The library came out from the observation that most problems in computational abstract algebra require a search algorithm. Instead of writing them again and again, it is natural to abstract the search part out. It is used by [KIGEN](https://github.com/egri-nagy/kigen).
This library contains generic search algorithms. A set-valued operator and predicates for recognizing possible and actual solutions need to be given.
The abstraction overhead is counterbalanced by parallel execution (using the reducers library).
## Orbit computation example
For computing al subsets of a set, we define the following set-valued function.
```clj
(defn subset-covers
"All covering (missing a single element only) subsets of a collection.
The collection is assumed to be a set."
[coll]
(map (fn [x]
(remove (partial = x) coll))
coll))
```
Then we can call a full-orbit function by giving the seeds (a 4-element set in this case) to calculate all subsets.
```clj
(orbit.core/full-orbit [(range 4)] subset-covers)
#{(0 1 3) (2 3) (0 2 3) (0 1 2) () (3) (1 3) (0) (0 3) (1 2 3) (0 2) (2) (1 2) (1) (0 1 2 3) (0 1)}
```
[Attila Egri-Nagy](http://www.egri-nagy.hu)