cytoscape
Advanced tools
Comparing version 3.20.1 to 3.21.0
{ | ||
"build/cytoscape.umd.js": { | ||
"bundled": 941704, | ||
"minified": 350892, | ||
"gzipped": 109101 | ||
"bundled": 1021871, | ||
"minified": 365007, | ||
"gzipped": 112477 | ||
}, | ||
"build/cytoscape.cjs.js": { | ||
"bundled": 868305, | ||
"minified": 370338, | ||
"gzipped": 111439 | ||
"bundled": 871227, | ||
"minified": 371337, | ||
"gzipped": 111837 | ||
}, | ||
"build/cytoscape.esm.js": { | ||
"bundled": 868132, | ||
"minified": 370195, | ||
"gzipped": 111404, | ||
"bundled": 870994, | ||
"minified": 371149, | ||
"gzipped": 111794, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 345544, | ||
"import_statements": 51 | ||
"code": 346486, | ||
"import_statements": 132 | ||
}, | ||
"webpack": { | ||
"code": 346928 | ||
"code": 347998 | ||
} | ||
@@ -27,15 +27,53 @@ } | ||
"build/cytoscape.esm.min.js": { | ||
"bundled": 350697, | ||
"minified": 350199, | ||
"gzipped": 108923, | ||
"bundled": 364812, | ||
"minified": 364287, | ||
"gzipped": 112306, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 349693, | ||
"code": 363750, | ||
"import_statements": 0 | ||
}, | ||
"webpack": { | ||
"code": 350981 | ||
"code": 365038 | ||
} | ||
} | ||
}, | ||
"build\\cytoscape.umd.js": { | ||
"bundled": 942118, | ||
"minified": 351104, | ||
"gzipped": 109191 | ||
}, | ||
"build\\cytoscape.esm.min.js": { | ||
"bundled": 350909, | ||
"minified": 350411, | ||
"gzipped": 109012, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 349903, | ||
"import_statements": 0 | ||
}, | ||
"webpack": { | ||
"code": 351193 | ||
} | ||
} | ||
}, | ||
"build\\cytoscape.cjs.js": { | ||
"bundled": 868703, | ||
"minified": 370553, | ||
"gzipped": 111528 | ||
}, | ||
"build\\cytoscape.esm.js": { | ||
"bundled": 868530, | ||
"minified": 370410, | ||
"gzipped": 111491, | ||
"treeshaked": { | ||
"rollup": { | ||
"code": 345754, | ||
"import_statements": 51 | ||
}, | ||
"webpack": { | ||
"code": 347140 | ||
} | ||
} | ||
} | ||
} |
{ | ||
"name": "cytoscape", | ||
"version": "3.20.1", | ||
"version": "3.21.0", | ||
"license": "MIT", | ||
@@ -158,3 +158,3 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", | ||
"livereload": "^0.9.1", | ||
"marked": "^1.0.0", | ||
"marked": "^4.0.10", | ||
"mocha": "^7.1.2", | ||
@@ -170,4 +170,7 @@ "npm-run-all": "^4.1.5", | ||
"heap": "^0.2.6", | ||
"lodash.debounce": "^4.0.8" | ||
"lodash.debounce": "^4.0.8", | ||
"lodash.get": "^4.4.2", | ||
"lodash.set": "^4.3.2", | ||
"lodash.topath": "^4.5.2" | ||
} | ||
} |
@@ -38,5 +38,13 @@ <img style="width: 200px; height: 200px;" src="https://raw.githubusercontent.com/cytoscape/cytoscape.js/unstable/documentation/img/cytoscape-logo.png" width="200" height="200"></img> | ||
## Example | ||
The Tokyo railway stations network can be visualised with Cytoscape: | ||
<img style="width: 300px; height: 126px;" src="https://raw.githubusercontent.com/cytoscape/cytoscape.js/unstable/documentation/img/tokyo-big.png" width="300" height="126"></img> | ||
<img style="width: 300px; height: 126px;" src="https://raw.githubusercontent.com/cytoscape/cytoscape.js/unstable/documentation/img/tokyo-big-zoomed-in.png" width="300" height="126"></img> | ||
A [live demo](https://js.cytoscape.org/demos/tokyo-railways/) and [source code](https://github.com/cytoscape/cytoscape.js/tree/master/documentation/demos/tokyo-railways) are available for the Tokyo railway stations graph. More demos are available in the [documentation](https://js.cytoscape.org/#demos). | ||
## Documentation | ||
@@ -43,0 +51,0 @@ |
@@ -124,2 +124,3 @@ import * as is from '../../is'; | ||
// Check for negative weight cycles | ||
const negativeWeightCycleIds = []; | ||
for( let e = 0; e < numEdges; e++ ){ | ||
@@ -134,7 +135,55 @@ let edge = edges[e]; | ||
if( srcDist + weight < tgtDist || (!directed && tgtDist + weight < srcDist) ){ | ||
warn('Graph contains a negative weight cycle for Bellman-Ford'); | ||
if( !hasNegativeWeightCycle ){ | ||
warn('Graph contains a negative weight cycle for Bellman-Ford'); | ||
hasNegativeWeightCycle = true; | ||
hasNegativeWeightCycle = true; | ||
} | ||
break; | ||
if( options.findNegativeWeightCycles !== false ){ | ||
const negativeNodes = []; | ||
if( srcDist + weight < tgtDist ){ | ||
negativeNodes.push(src); | ||
} | ||
if( !directed && tgtDist + weight < srcDist ) { | ||
negativeNodes.push(tgt); | ||
} | ||
const numNegativeNodes = negativeNodes.length; | ||
for( let n = 0; n < numNegativeNodes; n++ ){ | ||
const start = negativeNodes[n]; | ||
let cycle = [start]; | ||
cycle.push(getInfo(start).edge); | ||
let node = getInfo(start).pred; | ||
while( cycle.indexOf(node) === -1 ){ | ||
cycle.push(node); | ||
cycle.push(getInfo(node).edge); | ||
node = getInfo(node).pred; | ||
} | ||
cycle = cycle.slice(cycle.indexOf(node)); | ||
let smallestId = cycle[0].id(); | ||
let smallestIndex = 0; | ||
for( let c = 2; c < cycle.length; c+=2 ){ | ||
if( cycle[c].id() < smallestId ){ | ||
smallestId = cycle[c].id(); | ||
smallestIndex = c; | ||
} | ||
} | ||
cycle = cycle.slice(smallestIndex) | ||
.concat(cycle.slice(0, smallestIndex)); | ||
cycle.push(cycle[0]); | ||
const cycleId = cycle.map(el => el.id()).join(","); | ||
if( negativeWeightCycleIds.indexOf(cycleId) === -1 ){ | ||
negativeWeightCycles.push(eles.spawn(cycle)); | ||
negativeWeightCycleIds.push(cycleId); | ||
} | ||
} | ||
} else { | ||
break; | ||
} | ||
} | ||
@@ -141,0 +190,0 @@ } |
import * as util from '../util'; | ||
import * as is from '../is'; | ||
import get from 'lodash.get'; | ||
import set from 'lodash.set'; | ||
import toPath from 'lodash.topath'; | ||
@@ -34,3 +37,5 @@ let define = { | ||
// .data('foo', ...) | ||
if( is.string( name ) ){ // set or get property | ||
if (is.string(name)) { // set or get property | ||
let isPathLike = name.indexOf('.') !== -1; // there might be a normal field with a dot | ||
let path = isPathLike && toPath(name); | ||
@@ -44,3 +49,8 @@ // .data('foo') | ||
ret = single._private[ p.field ][ name ]; | ||
// check if it's path and a field with the same name doesn't exist | ||
if (path && single._private[ p.field ][ name ] === undefined) { | ||
ret = get(single._private[ p.field ], path); | ||
} else { | ||
ret = single._private[ p.field ][ name ]; | ||
} | ||
} | ||
@@ -61,3 +71,7 @@ return ret; | ||
if( p.canSet( ele ) ){ | ||
ele._private[ p.field ][ name ] = value; | ||
if (path && single._private[ p.field ][ name ] === undefined) { | ||
set(ele._private[ p.field ], path, value); | ||
} else { | ||
ele._private[ p.field ][ name ] = value; | ||
} | ||
} | ||
@@ -64,0 +78,0 @@ } |
@@ -175,2 +175,5 @@ import * as util from'./util'; | ||
} else if (type === '__proto__' || type === 'constructor' || type === 'prototype'){ | ||
// to avoid potential prototype pollution | ||
return util.error( type + ' is an illegal type to be registered, possibly lead to prototype pollutions' ); | ||
} | ||
@@ -177,0 +180,0 @@ |
@@ -18,2 +18,3 @@ import * as util from '../../util'; | ||
maximal: false, // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only) | ||
depthSort: undefined, // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') } | ||
animate: false, // whether to transition the node positions | ||
@@ -297,2 +298,6 @@ animationDuration: 500, // duration of animation in ms if enabled | ||
if (options.depthSort !== undefined) { | ||
sortFn = options.depthSort; | ||
} | ||
// sort each level to make connected nodes closer | ||
@@ -299,0 +304,0 @@ for( let i = 0; i < depths.length; i++ ){ |
@@ -19,3 +19,3 @@ import * as util from '../util'; | ||
}; | ||
tokens.variable = '(?:[\\w-]|(?:\\\\' + tokens.metaChar + '))+'; // a variable name | ||
tokens.variable = '(?:[\\w-.]|(?:\\\\' + tokens.metaChar + '))+'; // a variable name | ||
tokens.value = tokens.string + '|' + tokens.number; // a value literal, either a string or number | ||
@@ -22,0 +22,0 @@ tokens.className = tokens.variable; // a class name (follows variable conventions) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
4400680
110754
160
5
+ Addedlodash.get@^4.4.2
+ Addedlodash.set@^4.3.2
+ Addedlodash.topath@^4.5.2
+ Addedlodash.get@4.4.2(transitive)
+ Addedlodash.set@4.3.2(transitive)
+ Addedlodash.topath@4.5.2(transitive)