Giter VIP home page Giter VIP logo

Comments (11)

ugurdogrusoz avatar ugurdogrusoz commented on August 15, 2024

From Max:

Cytoscape.js uses the Weaver APIs for multitasking. Because of how webworkers work, you either have to keep multitasking code unminified or use a bit of extra reference fixing.

See the minification info and ref()

Ideally, CoSE should use _ref_() so that clients don't have to worry about minification issues. Alternatively, not minifying the cose-bilkent.js file should work around the issue.

from cytoscape.js-cose-bilkent.

ugurdogrusoz avatar ugurdogrusoz commented on August 15, 2024

Hi Danny, I hope you're not in urgent need of this getting fixed. We hope to address it in the future though.

from cytoscape.js-cose-bilkent.

dannymcpherson avatar dannymcpherson commented on August 15, 2024

Thanks for following up. No worries - I just prevent it from being minified and it works fine.

from cytoscape.js-cose-bilkent.

cmdcolin avatar cmdcolin commented on August 15, 2024

Also just ran into this issue. Would be interested if there was a workaround but happy to go unminified

from cytoscape.js-cose-bilkent.

maxkfranz avatar maxkfranz commented on August 15, 2024

The issue is the dependency tree of all of the classes.

Options:

(1) Remove all classes and instead use pure functions with plain objects. This is the ideal solution. It would greatly cut down on the file size and it would make it trivial to support minification. It would also make the algorithm itself run much faster.

(2) Remove all class dependencies. Probably not practical

(3) Don't use multitasking. The algorithm is already slower than the embedded CoSE, because it creates many class instances on every iteration of the algorithm -- so maybe multitasking doesn't matter that much.

from cytoscape.js-cose-bilkent.

cmdcolin avatar cmdcolin commented on August 15, 2024

awesome news! I was gonna test it out but i'm wondering if maybe I'm building it wrong or if latest npm package is configured weird

I tried adding cytoscape-cose-bilkent and cytoscape latest versions and building with gulp but got an error

example

var gulp = require('gulp');
var uglify = require('gulp-uglify');
var browserify = require('gulp-browserify');

gulp.task('build', function () {
    gulp.src(['index.js'])
        .pipe(browserify())
        .pipe(uglify())
        .pipe(gulp.dest('dist'));


    return 1;
});
gulp.task('default', ['build']);
var cycose = require('cytoscape-cose-bilkent')
var cytoscape = require('cytoscape')
cycose(cytoscape)
gulp           
[17:39:27] Using gulpfile ~/test2/gulpfile.js
[17:39:27] Starting 'build'...
[17:39:27] Finished 'build' after 14 ms
[17:39:27] Starting 'default'...
[17:39:27] Finished 'default' after 47 μs

events.js:161
      throw er; // Unhandled 'error' event
      ^
Error: module "./FDLayoutConstants" not found from "/Users/me/test2/node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js"
    at notFound (/Users/me/test2/node_modules/browserify/index.js:803:15)
    at /Users/me/test2/node_modules/browserify/index.js:754:23
    at /Users/me/test2/node_modules/browser-resolve/index.js:185:24
    at /Users/me/test2/node_modules/browser-resolve/node_modules/resolve/lib/async.js:36:22
    at load (/Users/me/test2/node_modules/browser-resolve/node_modules/resolve/lib/async.js:54:43)
    at /Users/me/test2/node_modules/browser-resolve/node_modules/resolve/lib/async.js:60:22
    at /Users/me/test2/node_modules/browser-resolve/node_modules/resolve/lib/async.js:16:47
    at FSReqWrap.oncomplete (fs.js:114:15)
➜  test git:(master) ✗ cat Gulpfile.js 

from cytoscape.js-cose-bilkent.

maxkfranz avatar maxkfranz commented on August 15, 2024

It builds fine on my machine. You don't have to build anyway. main points to the prebuilt file

from cytoscape.js-cose-bilkent.

cmdcolin avatar cmdcolin commented on August 15, 2024

I'm wondering if maybe it is hardcoding paths to your computer? This is the top of cytoscape-cose-bilkent.js

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/max/Documents/workspace/cytoscape.js-cose-bilkent/src/Layout/CoSEConstants.js":[function(require,module,exports){
var FDLayoutConstants = require('./FDLayoutConstants');

function CoSEConstants() {
}

//CoSEConstants inherits static props in FDLayoutConstants
for (var prop in FDLayoutConstants) {
  CoSEConstants[prop] = FDLayoutConstants[prop];
}

CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false;
CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH;
CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;

module.exports = CoSEConstants;

},{"./FDLayoutConstants":"/Users/max/Documents/workspace/cytoscape.js-cose-bilkent/src/Layout/FDLayoutConstants.js"}],"/Users/max/Documents/workspace/cytoscape.js-cose-bilkent/src/Layout/CoSEEdge.js":[function(require,module,exports){
var FDLayoutEdge = require('./FDLayoutEdge');

from cytoscape.js-cose-bilkent.

maxkfranz avatar maxkfranz commented on August 15, 2024

Try 1.4.1

It just points main to ./src

It's better for bundlers like Browserify and Webpack, anyway

from cytoscape.js-cose-bilkent.

cmdcolin avatar cmdcolin commented on August 15, 2024

@maxkfranz that seems like it builds now! I get an error at runtime though...trying to create minimal example, maybe I'll make a new issue!

rhill-voronoi-core.js:1721 Uncaught ReferenceError: Point is not defined
    at CoSELayout.positionNodesRadially (rhill-voronoi-core.js:1721)
    at CoSELayout.classicLayout (rhill-voronoi-core.js:1721)
    at CoSELayout.layout (rhill-voronoi-core.js:1721)
    at CoSELayout.Layout.runLayout (rhill-voronoi-core.js:1721)
    at run (rhill-voronoi-core.js:1721)
    at Layout._CoSELayout.run (rhill-voronoi-core.js:1721)
    at Core.layout (rhill-voronoi-core.js:1721)
    at Core.load (rhill-voronoi-core.js:1721)
    at rhill-voronoi-core.js:1721
    at loadExtData (rhill-voronoi-core.js:1721)

from cytoscape.js-cose-bilkent.

maxkfranz avatar maxkfranz commented on August 15, 2024

@cmdcolin OK, looking forward to the test case

from cytoscape.js-cose-bilkent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.