graphology-operators
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -8,2 +8,3 @@ /** | ||
exports.reverse = require('./reverse.js'); | ||
exports.toSimple = require('./to-simple.js'); | ||
exports.union = require('./union.js'); |
The MIT License (MIT) | ||
Copyright (c) 2016 Guillaume Plique (Yomguithereal) | ||
Copyright (c) 2016-2020 Guillaume Plique (Yomguithereal) | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "graphology-operators", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Miscellaneous operators for graphology.", | ||
"main": "index.js", | ||
"files": [ | ||
"*.d.ts", | ||
"index.js", | ||
"reverse.js", | ||
"to-simple.js", | ||
"union.js" | ||
@@ -13,2 +15,3 @@ ], | ||
"lint": "eslint *.js", | ||
"prepublish": "npm run lint && npm test", | ||
"test": "mocha test.js" | ||
@@ -36,6 +39,6 @@ }, | ||
"devDependencies": { | ||
"@yomguithereal/eslint-config": "^3.0.0", | ||
"eslint": "^3.5.0", | ||
"graphology": "0.4.0", | ||
"mocha": "^3.0.2" | ||
"@yomguithereal/eslint-config": "^4.0.0", | ||
"eslint": "^6.8.0", | ||
"graphology": "^0.15.0", | ||
"mocha": "^7.0.1" | ||
}, | ||
@@ -46,4 +49,5 @@ "eslintConfig": { | ||
"dependencies": { | ||
"graphology-types": "^0.15.0", | ||
"graphology-utils": "^1.1.1" | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
[![Build Status](https://travis-ci.org/graphology/graphology-operators.svg)](https://travis-ci.org/graphology/graphology-operators) | ||
# Graphology Operators | ||
@@ -21,2 +23,6 @@ | ||
*Cast* | ||
* [toSimple](#tosimple) | ||
### reverse | ||
@@ -54,1 +60,15 @@ | ||
* **H** *Graph*: second graph. | ||
### toSimple | ||
Returns the simple version of the given multigraph where we only keep a single edge of each type between nodes. | ||
If a simple graph is passed, the function will only return a copy of it. | ||
```js | ||
import {toSimple} from 'graphology-operators'; | ||
// Alternatively, to load only the relevant code: | ||
import toSimple from 'graphology-operators/to-simple'; | ||
const simpleGraph = toSimple(multiGraph); | ||
``` |
@@ -20,6 +20,10 @@ /** | ||
// Importing the nodes | ||
reversed.importNodes(graph.exportNodes()); | ||
graph.forEachNode(function(n, a) { | ||
reversed.addNode(n, a); | ||
}); | ||
// Importing undirected edges | ||
reversed.importEdges(graph.exportUndirectedEdges()); | ||
graph.forEachUndirectedEdge(function(e) { | ||
reversed.importEdge(graph.exportEdge(e)); | ||
}); | ||
@@ -26,0 +30,0 @@ // Reversing directed edges |
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
7137
11
109
73
2
+ Addedgraphology-types@^0.15.0
+ Addedgraphology-types@0.15.5(transitive)