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