1 | # iper
|
2 |
|
3 | > Hypergraphs for breakfast!
|
4 |
|
5 | [![Node engine](https://img.shields.io/node/v/iper.svg)](https://nodejs.org/en/) [![NPM version](https://badge.fury.io/js/iper.svg)](http://badge.fury.io/js/iper) [![Build Status](https://travis-ci.org/fibo/iper.svg?branch=master)](https://travis-ci.org/fibo/iper?branch=master) [![Dependency Status](https://gemnasium.com/fibo/iper.svg)](https://gemnasium.com/fibo/iper) [![Coverage Status](https://coveralls.io/repos/fibo/iper/badge.svg?branch=master)](https://coveralls.io/r/fibo/iper?branch=master) [![Test page](https://img.shields.io/badge/test-page-blue.svg)](http://g14n.info/iper/test)
|
6 |
|
7 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
|
8 |
|
9 | [![NPM](https://nodei.co/npm-dl/iper.png)](https://nodei.co/npm-dl/iper/)
|
10 |
|
11 | ## Installation
|
12 |
|
13 | With [npm](https://npmjs.org/) do
|
14 |
|
15 | ```bash
|
16 | npm install iper
|
17 | ```
|
18 |
|
19 | With [bower](http://bower.io/) do
|
20 |
|
21 | ```bash
|
22 | bower install iper
|
23 | ```
|
24 |
|
25 | ## API
|
26 |
|
27 | ### `new Graph([graph])`
|
28 |
|
29 | > Hypergraph constructor.
|
30 |
|
31 | ```javascript
|
32 | var graph = new Graph()
|
33 | ```
|
34 |
|
35 | * **@param** `{Object}` [graph]
|
36 | * **@param** `{Object}` [graph.edges]
|
37 | * **@param** `{Object}` [graph.nodes]
|
38 | * **@param** `{Boolean}` [graph.multigraph] can contain duplicated edges
|
39 | * **@param** `{Boolean}` [graph.pseudograph] is a multigraph with loops allowed
|
40 | * **@param** `{Number}` [graph.uniform] all edges has the same cardinality (i.e. number of nodes)
|
41 |
|
42 | ### graph.addEdge(nodeIds)
|
43 |
|
44 | > Add an hyperedge that connects given nodeIds.
|
45 |
|
46 | * **@param** `{Array}` nodeIds
|
47 | * **@returns** `{String}` id
|
48 |
|
49 | ### graph.addNode(data)
|
50 |
|
51 | > Add a node, containing given data.
|
52 |
|
53 | ```javascript
|
54 | var nodeId = graph.addNode({ label: 'foo' })
|
55 | ```
|
56 |
|
57 | * **@param** `{*}` [data]
|
58 | * **@returns** `{String}` id of the node created
|
59 |
|
60 | ### graph.degreeOf(nodeId)
|
61 |
|
62 | > Returns the degree of a node, that is the number of incident edges with loops counted twice.
|
63 |
|
64 | * **@param** `{String}` id
|
65 | * **@returns** `{void}`
|
66 |
|
67 | ### graph.delEdge(id)
|
68 |
|
69 | > Delete edge by given id.
|
70 |
|
71 | * **@param** `{String}` id
|
72 | * **@returns** `{void}`
|
73 |
|
74 | ### graph.delNode(id)
|
75 |
|
76 | > Delete node by given id.
|
77 |
|
78 | * **@param** `{String}` id
|
79 | * **@returns** `{void}`
|
80 |
|
81 | ## License
|
82 |
|
83 | [MIT](http://www.g14n.info/mit-license)
|