graphology-utils
Advanced tools
Comparing version 1.8.0 to 2.0.0
@@ -0,1 +1,3 @@ | ||
export * from './add-edge'; | ||
export * from './add-node'; | ||
export {default as inferType} from './infer-type'; | ||
@@ -8,2 +10,1 @@ export {default as isGraph} from './is-graph'; | ||
export {default as mergeStar} from './merge-star'; | ||
export {default as subGraph} from './subgraph'; |
@@ -7,2 +7,10 @@ /** | ||
*/ | ||
var addEdgeModule = require('./add-edge'); | ||
var addNodeModule = require('./add-node'); | ||
exports.addEdge = addEdgeModule.addEdge; | ||
exports.copyEdge = addEdgeModule.copyEdge; | ||
exports.mergeEdge = addEdgeModule.mergeEdge; | ||
exports.updateEdge = addEdgeModule.updateEdge; | ||
exports.copyNode = addNodeModule.updateNode; | ||
exports.inferType = require('./infer-type.js'); | ||
@@ -15,2 +23,1 @@ exports.isGraph = require('./is-graph.js'); | ||
exports.mergeStar = require('./merge-star.js'); | ||
exports.subGraph = require('./subgraph.js'); |
{ | ||
"name": "graphology-utils", | ||
"version": "1.8.0", | ||
"version": "2.0.0", | ||
"description": "Miscellaneous utils for graphology.", | ||
@@ -8,2 +8,4 @@ "main": "index.js", | ||
"*.d.ts", | ||
"add-edge.js", | ||
"add-node.js", | ||
"index.js", | ||
@@ -16,4 +18,3 @@ "infer-type.js", | ||
"merge-path.js", | ||
"merge-star.js", | ||
"subgraph.js" | ||
"merge-star.js" | ||
], | ||
@@ -52,4 +53,4 @@ "types": "./index.d.ts", | ||
"@yomguithereal/eslint-config": "^4.0.0", | ||
"eslint": "^7.13.0", | ||
"graphology": "^0.19.1", | ||
"eslint": "^7.15.0", | ||
"graphology": "^0.19.2", | ||
"graphology-types": "0.19.0", | ||
@@ -56,0 +57,0 @@ "mocha": "^8.2.1" |
@@ -15,5 +15,13 @@ [![Build Status](https://travis-ci.org/graphology/graphology-utils.svg)](https://travis-ci.org/graphology/graphology-utils) | ||
* [#.inferType](#infertype) | ||
*Assertions* | ||
* [#.isGraph](#isgraph) | ||
* [#.isGraphConstructor](#isgraphconstructor) | ||
*Introspection* | ||
* [#.inferType](#infertype) | ||
*Typical edge patterns* | ||
* [#.mergeClique](#mergeclique) | ||
@@ -23,3 +31,2 @@ * [#.mergeCycle](#mergecycle) | ||
* [#.mergeStar](#mergestar) | ||
* [#.subGraph](#subgraph) | ||
@@ -176,38 +183,1 @@ ### #.inferType | ||
* **star** *array*: array of nodes representing the star to add. | ||
### #.subGraph | ||
Function returning the subgraph corresponding to the given list of nodes. | ||
```js | ||
import Graph from 'graphology'; | ||
import {subGraph} from 'graphology-utils'; | ||
// Alternatively, if you want to only load the relevant code: | ||
import subGraph from 'graphology-utils/subgraph'; | ||
const graph = new Graph(); | ||
graph.addNode('Dale'); | ||
graph.addNode('Laura'); | ||
graph.addNode('Norma'); | ||
graph.addNode('Shelly'); | ||
graph.addEdge('Dale', 'Laura'); | ||
graph.addEdge('Dale', 'Norma'); | ||
graph.addEdge('Shelly', 'Laura'); | ||
graph.addUndirectedEdge('Norma', 'Shelly'); | ||
subGraphResult = subGraph(graph, ['Dale', 'Laura']); | ||
subGraphResult.nodes(); | ||
>>> [ 'Dale', 'Laura' ] | ||
subGraphResult.forEachEdge( | ||
(edge, attributes, source, target) => { | ||
console.log(`Edge from ${source} to ${target}`); | ||
}); | ||
>>> 'Edge from Dale to Laura' | ||
``` | ||
*Arguments* | ||
* **graph** *Graph*: source graph. | ||
* **nodes** *array|Set|function*: the array, set or function defining the subgraph's nodes. | ||
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
16493
23
328
181