graphology-metrics
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -7,4 +7,5 @@ /** | ||
*/ | ||
exports.centrality = require('./centrality'); | ||
exports.density = require('./density.js'); | ||
exports.extent = require('./extent.js'); | ||
exports.modularity = require('./modularity.js'); | ||
exports.centrality = require('./centrality'); |
@@ -45,9 +45,9 @@ /** | ||
if (!isGraph(graph)) | ||
throw new Error('graphology-modularity: the given graph is not a valid graphology instance.'); | ||
throw new Error('graphology-metrics/modularity: the given graph is not a valid graphology instance.'); | ||
if (graph.multi) | ||
throw new Error('graphology-louvain: multi graphs are not handled.'); | ||
throw new Error('graphology-metrics/modularity: multi graphs are not handled.'); | ||
if (!graph.size) | ||
throw new Error('graphology-modularity: the given graph has no edges.'); | ||
throw new Error('graphology-metrics/modularity: the given graph has no edges.'); | ||
@@ -54,0 +54,0 @@ // Solving options |
{ | ||
"name": "graphology-metrics", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Miscellaneous graph metrics for graphology.", | ||
@@ -22,2 +22,3 @@ "main": "index.js", | ||
"density", | ||
"extent", | ||
"graph", | ||
@@ -46,5 +47,5 @@ "graphology", | ||
"chai": "^4.0.0", | ||
"eslint": "^4.10.0", | ||
"graphology": "^0.11.0", | ||
"mocha": "^4.0.1" | ||
"eslint": "^4.18.2", | ||
"graphology": "^0.11.1", | ||
"mocha": "^4.1.0" | ||
}, | ||
@@ -56,4 +57,4 @@ "eslintConfig": { | ||
"graphology-utils": "^1.1.1", | ||
"lodash": "^4.17.4" | ||
"lodash": "^4.17.5" | ||
} | ||
} |
@@ -18,2 +18,3 @@ [![Build Status](https://travis-ci.org/graphology/graphology-metrics.svg)](https://travis-ci.org/graphology/graphology-metrics) | ||
* [Density](#density) | ||
* [Extent](#extent) | ||
* [Modularity](#modularity) | ||
@@ -64,2 +65,27 @@ | ||
### Extent | ||
Computes the extent - min, max - of a node or edge's attribute. | ||
```js | ||
import extent from 'graphology-metrics/extent'; | ||
// Retrieving a single node attribute's extent | ||
extent(graph, 'size'); | ||
>>> [1, 34] | ||
// Retrieving multiple node attributes' extents | ||
extent(graph, ['x', 'y']); | ||
>>> {x: [-4, 3], y: [-34, 56]} | ||
// For edges | ||
extent.edgeExtent(graph, 'weight'); | ||
>>> [0, 5.7] | ||
``` | ||
*Arguments* | ||
* **graph** *Graph*: target graph. | ||
* **attributes** *string|array*: single attribute names or array of attribute names. | ||
### Modularity | ||
@@ -66,0 +92,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18369
9
401
146
+ Addedgraphology-types@0.24.8(transitive)
- Removedgraphology-types@0.24.7(transitive)
Updatedlodash@^4.17.5