graphology-utils
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -7,2 +7,3 @@ /** | ||
*/ | ||
exports.inferType = require('./infer-type.js'); | ||
exports.isGraph = require('./is-graph.js'); | ||
@@ -9,0 +10,0 @@ exports.isGraphConstructor = require('./is-graph-constructor.js'); |
The MIT License (MIT) | ||
Copyright (c) 2017 Guillaume Plique (Yomguithereal) | ||
Copyright (c) 2017-2019 Guillaume Plique (Yomguithereal) | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "graphology-utils", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Miscellaneous utils for graphology.", | ||
"main": "index.js", | ||
"files": [ | ||
"*.d.ts", | ||
"index.js", | ||
@@ -17,3 +18,3 @@ "is-graph.js", | ||
"scripts": { | ||
"lint": "eslint **/*.js", | ||
"lint": "eslint '**/*.js'", | ||
"prepublish": "npm run lint && npm test", | ||
@@ -48,5 +49,5 @@ "test": "mocha test.js" | ||
"@yomguithereal/eslint-config": "^4.0.0", | ||
"eslint": "^4.18.2", | ||
"graphology": "^0.13.1", | ||
"mocha": "^5.2.0" | ||
"eslint": "^6.7.2", | ||
"graphology": "^0.15.1", | ||
"mocha": "^7.0.1" | ||
}, | ||
@@ -58,3 +59,6 @@ "eslintConfig": { | ||
} | ||
}, | ||
"dependencies": { | ||
"graphology-types": "^0.15.1" | ||
} | ||
} |
@@ -15,4 +15,6 @@ [![Build Status](https://travis-ci.org/graphology/graphology-utils.svg)](https://travis-ci.org/graphology/graphology-utils) | ||
* [#.inferType](#infertype) | ||
* [#.isGraph](#isgraph) | ||
* [#.isGraphConstructor](#isgraphconstructor) | ||
* [#.mergeClique](#mergeclique) | ||
* [#.mergeCycle](#mergecycle) | ||
@@ -23,2 +25,19 @@ * [#.mergePath](#mergepath) | ||
### #.inferType | ||
Function returning the inferred type of the given graph. This function is useful to check whether a given mixed graph is in fact a mere `directed` or `undirected` graph based on its actual edges. | ||
```js | ||
import Graph from 'graphology'; | ||
import {inferType} from 'graphology-utils'; | ||
// Alternatively, if you want to only load the relevant code: | ||
import inferType from 'graphology-utils/infer-type'; | ||
const graph = new Graph(); | ||
graph.addUndirectedEdge(1, 2); | ||
inferType(graph); | ||
>>> 'directed' | ||
``` | ||
### #.isGraph | ||
@@ -74,5 +93,23 @@ | ||
### #.mergeClique | ||
Function adding a clique to the given graph. | ||
```js | ||
import Graph from 'graphology'; | ||
import {mergeClique} from 'graphology-utils'; | ||
// Alternatively, if you want to only load the relevant code: | ||
import mergeClique from 'graphology-utils/merge-clique'; | ||
const graph = new Graph(); | ||
mergeClique(graph, [1, 2, 3]); | ||
graph.edges().map(e => graph.extremities(e)); | ||
>>> [[1, 2], [1, 3], [2, 3]] | ||
``` | ||
### #.mergeCycle | ||
Function adding a star to the given graph. | ||
Function adding a cycle to the given graph. | ||
@@ -79,0 +116,0 @@ ```js |
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
15039
20
255
211
1
+ Addedgraphology-types@^0.15.1
+ Addedgraphology-types@0.15.5(transitive)