Skip to content
Combinatorics Javascript Library
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.
dist
lib
test
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
bower.json
component.json
composer.json
gulpfile.js
index.js
package.json

README.md

Combinatorics.js

Introduction

Combinatorics.js is a standalone math library for Javascript and Node.js. It features a solution to work with Permutations, Posets, Trees, and other enumerative collections.

Combinatorics.js is also a module to math.js.

Please see this blog article to get a general feel for this project.

Table of Contents

  1. Install/Build
  2. Roadmap
  3. Contributing
  4. License

Install/Build

To clone this project:

git clone git@github.com:devanp92/combinatorics.js.git
cd combinatorics.js

To install via npm:

npm install combinatoricsjs

To install the necessary dependencies:

npm install

To test we use Mocha:

npm test // mocha test --recursive

To build we use Gulp:

gulp

Roadmap

A rough roadmap for Combinatorics.js

  1. Permutation: π : {1...n} -> {1...n}:

    • Behaviors
      • Inverse
      • Multiply
      • Calculate number of cycles
      • Complement
      • Reverse
      • Randomize Permutation
    • States
      • Number of cycles
      • Parity (odd/even)
      • Number of fixed points (is it a Derangement?)
      • Is Identity
    • Ancillary
      • Create/Return iterator
      • Print to cycle notation
  2. Permutation Patterns (subclass of Permutation)

    A permutation π is said to 'contain' a permutation σ (σ is a permuation {1..m}, such that m < n) if there exists a subsequence in π in the same relative order.

    Alternatively, a permutation avoids σ if there does not exist such a subsequence.

    • Behaviors
      • Contains
      • Avoids
      • Permutation avoiding pattern generator (all permutations π from [1..n] avoiding σ)
    • States
      • List of permutations given containing or avoiding a pattern
      • Cardinality
  3. Util Functions

    • Is Integer
    • Combinations
    • Enumerative Methods
      • Bell Numbers
      • Stirling numbers of the first kind
      • Partitions
        • (Weak) Compositions
        • Set Partitions
          • Stirling numbers of the second kind
        • Integer Paritions

Contributing

Feel free to contribute to combinatorics.js! You can contribute in different ways: spread the word, report bugs, come up with ideas and suggestions, and contribute to the code.

There are a few preferences regarding code contributions:

Combinatorics.js follows the node.js code style

Send pull requests to the develop branch, not the master branch.

Pleae do not commit any files other than in lib/ and test/.

If adding functionality, please include source (lib/) and test (test/) files.

Thanks!

Adapted from math.js

License

The MIT License (MIT)

Copyright (c) 2016 Devan Patel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.