https://github.com/rootslab/alice
Alice, a simple and performant data structure for bipartite graphs with integer values as vertices.
https://github.com/rootslab/alice
bfs bfs-algorithm bipartite-graphs dfs dfs-algorithm graphql
Last synced: 22 days ago
JSON representation
Alice, a simple and performant data structure for bipartite graphs with integer values as vertices.
- Host: GitHub
- URL: https://github.com/rootslab/alice
- Owner: rootslab
- License: mit
- Created: 2015-01-14T18:54:27.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-02-10T14:40:08.000Z (over 7 years ago)
- Last Synced: 2025-09-16T16:33:51.384Z (about 2 months ago)
- Topics: bfs, bfs-algorithm, bipartite-graphs, dfs, dfs-algorithm, graphql
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
### Alice
[](https://www.npmjs.org/package/alice)
[](https://www.codacy.com/public/44gatti/alice)
[](https://codeclimate.com/github/rootslab/alice)
[](https://github.com/rootslab/alice#mit-license)

[](http://travis-ci.org/rootslab/alice)
[](https://david-dm.org/rootslab/alice)
[](https://david-dm.org/rootslab/alice#info=devDependencies)
[](http://npm-stat.com/charts.html?package=alice)

[](https://nodei.co/npm/alice/)
> __Alice__, a simple and performant data structure for bipartite graphs with integer values as vertices.
### Install
```bash
$ npm install alice [-g]
```
> __require__:
```javascript
var Alice = require( 'alice' );
```
### Run Tests
> __to run all test files, install devDependencies:__
```bash
$ cd alice/
# install or update devDependencies
$ npm install
# run tests
$ npm test
```
> __to execute a single test file simply do__:
```bash
$ node test/file-name.js
```
### Constructor
```javascript
Alice()
// or
new Alice()
```
### Properties
```javascript
/*
* total edges
*/
Alice.edges : Number
/*
* graph edges
*/
Alice.e : Number
/*
* graph vertices
*/
Alice.v : Number
```
### Methods
> Arguments between [] are optional.
```javascript
/*
* Add an edge to the graph.
*/
Alice#add : function ( Number x, Number y [, Boolean strict [, Object label ] ] ) : Number
/*
* Cut an edge from the graph.
*/
Alice#cut : function ( Number x, Number y ) : Number
/*
* Clear edges and vertices.
*/
Alice#fire : function () : Alice
/*
* Prune edges to test graph acyclicity.
* It optionally returns every edge as a single array [ x, y ]
*/
Alice#prune : function ( [ Boolean edge_as_array ] ) : Array
/*
* Perform A Depth-First Search starting from the input vertex.
* It returns a list of vertices
*/
Alice#depth : function ( Number x ) : Array
/*
* Perform A Breadth-First Search starting from the input vertex.
* It returns a list of vertices
*/
Alice#breadth : function ( Number x ) : Array
/*
* It returns the list of edges
*/
Alice#elist() : function () : Array
```
### MIT License
> Copyright (c) 2015-present < Guglielmo Ferri : 44gatti@gmail.com >
> 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.
[](https://github.com/igrigorik/ga-beacon)