Code Monkey home page Code Monkey logo

jsnetworkx's People

Contributors

duckpunch avatar fkling avatar midgleyf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsnetworkx's Issues

Tree generator not working as expected

Hi fkling,
What is the purpose of this part of the balanced tree generator code?

  if (r === 1) {
    n = 2;
  }

It appears to limit trees of degree one to only two nodes. For example, generating a tree of degree 1 and height 3 should give something like this:
expected tree

Instead, we get this:
untitled

Publish to NPM

I intend to start publishing pre-release versions to NPM as soon as the API documentation generation system is in place, and the change to camelCase API is complete.

jsnx unresolved variable

Hello,

I've used the python version of Networkx so was interested in trying out this port.

I'm working on Windows 7 box and use the RubyMine IDE I've created a script tag

<script src="js/jsnetworkx.js"></script> <script src="js/main.js"></script>

However in my main.js if I declare

var G = jsnx.complete_graph(6);

The error jsnx unresolved is produced, can you advise what I'm doing wrong?

Brian

Multiple tests fail in Firefox, especially those related to MultiDiGraph

JSNetworkX makes use of Google closures iterator module, which recognises objects with a __iterator__ a iterables.

Firefox' JavaScript version also supports this property, but for normal for...in loops, and thus, every for...in statement that is supposed to iterate over the properties of such an object breaks.

Need mantainer?

Hello there,
wondering if you need a mantainer to update some part of the codebase and be inline with the PRs,
ping me in case!

n

Recompiling with latest version of Closure Library breaks iterators

Hi, I've run into some trouble lately since I had to modify JSNetworkX. Recompiling with the latest version of the Closure Library (or maybe it's the newer Closure Compiler?) seems to cause .next() to be obfuscated on all iterators. Graph.nodes_iter() and jsnx.sentinelIterator() both return fully obfuscated objects. I checked both on my changes and on 031524a, but got the same result (.next() gets renamed to b). Any suggestions?

how to add a label for every node ?

Hi ,I want to add a string on every node, but with_labels just add the node's name in the circle ,how to make a label beside the circle ? and I also want to set different size for every circle , thank you very much .

.gml parsing (AJAX)

After looking at the codebase, I haven't found this because well, it's probably not something someone really should do, meaning that they should really port it to some other representation.

But it might help those moving from NetworkX to JSNetworkX to easily adopt. It also helps those who are more dependent on Gephi for network science. This also could mean that JSNetworkX could potentially build a browser based version of Gephi should this project grow that way.

I thought I'd just begin the discussion.

Self loops are not drawn

Self loops are not shown in the graph. Furthermore, if the graph is drawn with labels, self loop labels appear in the upper left corner of the canvas.

Run tests in browser

Running the tests in node should be sufficient most of the time, but being able to run them in the browser as well would be an additional safe guard.

Porting of max_weighted_matching

I have a JavaScript version of the max_weighted_matching procedure here. It is not a port of the NetworkX version but of the original implementation made by Joris van Rantwijk. I do not know if this can help.

Error while computing eigenvectorCentrality

Hi,
I am trying to use jsnx for a project. I am successfully able to maintain and update the graph data structure and use the ported functions to get the values I need. However, when trying to compute the eigenvectorCentrality, I get the following error:

"Uncaught #" (jsnetworkx.js - Line 2)

I can't figure what the issue is since other functions seem to be working just fine with the same graph. This is the syntax I am using

jsnx.eigenvectorCentrality(networkXGraph)

where networkXGraph holds the graph I am using.

Any help with this would be greatly appreciated.

Release v0.3

  • Update website examples to use the new API (changes are made but not pushed yet)
  • Add API documentation to website (#28)
  • Write changelog
  • Publish on NPM (#42)

closeness and degree centrality

Hey There, I am happy to help start knocking out some of the basic centrality algos.

I have a small contribution in the python library.

Nice work on the library - really love the implementation of ES6! JavaScript is really making it easier to do this kind of work.

Why so much code duplication?

I've noticed that subclasses of Graph pretty much completely re-implement the Graph api, rather than delegating to internal methods and just overriding those internal methods.

Is there a reason for this? Performance?

Info: Development progress

I'm going to use this new issue as a way to document my progress of refactoring the code. I'm also happy to receive comments and suggestions.

(this is an experiment, I'm not sure if I'm disciplined enough to keep this up, but I will try my best :) )

Feedback wanted: Algorithms and promises

We cannot do CPU intensive computations without asynchronous processing (e.g. web workers). Should we change the API and always return promises from all algorithm functions, or provide an extra build which does that?

sigmajs support

How easy would it be to integrate support for the sigmajs visualisation library?

I think the json graph representation that sigma.js accepts matches the one use by the d3.js network layout?

Feedback wanted: Iterables, especially objects

Currently the helper functions to iterate over "collections" iterate over the property names of an object, not its values. That's how it is in Python as well. I'm wondering if this is expected behavior or surprising. We could also iterate over the property values instead.

Maybe we should even distinguish between iterables with key => value and index => value, i.e. KeyedIterable and IndexIterable.

Create a documentation generation system

Current idea: Run a separate site/service that automatically rebuilds the documentation after pushing to GitHub.

The service will just be a React site that gets the API information from a JSON blob. The plan is to generate documentation for master and different versions (minor versions before 1.0). E.g. now we would only have master. When v0.3 is released, we will have master and the latest v0.3.x. tag.

I will probably create a new repo for that.

Tests: Shallow copies use different attrdicts?

Maybe I'm confused, but I was under the impression that the payload for nodes and edges was shallowly copied for the copy-constructor and deeply copied for the subgraph/to_directed/etc methods, but I see in test_0_graph.js:

BaseAttrGraphTester.prototype.is_shallow_copy = function(H, G) {
    this.graphs_equal(H, G);
    this.different_attrdict(H, G);
    this.shallow_copy_attrdict(H, G);
};

What am I missing?

Redesign drawing API

There currently is only the draw function which is like a one-of black box. It's not possible to make changes to the drawing config (without completely redrawing the graph), to extend it to support different kinds of visualization or different layouts.

I already started working on rewriting this part a long time ago and think that it's a good opportunity to introduce it with the next release.

The drawing API will be evolve around an abstract Visualization class which exposes an API that allows easily update an existing visualization. This class can be subclassed to provide different implements. I already have one for SVG output (with D3) and WebGL (experimental, with Three.js). The configuration options will mostly stay the same, but the API is richer.

Usage will look something like this:

var v = jsnx.draw(G, container, {/* some config here */}); // defaults to SVG visualization
// now or later
v.labels(true); // show labels
// or
v.labels(function(d) { return d.data.name; }); // show labels and use node data "name"
v.nodeStyle({style: {fill: 'red' }}); // style options depend on visualization

An implementation might not support every method. E.g. the WebGL implementation currently doesn't support labels, so calling v.labels() will just do nothing. On the other hand, implementations might offer additional methods, e.g. the WebGL implementation provides v.camera to the set the camera to be used.

jsnx.allPairsDijkstraPath fails with complex node types

The following code will work when nodes are primitive objects, but not when complex objects.

function test(p) {
    var G = new jsnx.Graph();
    G.addStar(p, {weight: 1.0});
    return jsnx.allPairsDijkstraPath(G)
}

test([1,2,3,4]); // works
test([{name: "cat"},{name: "dog"},{name: "mouse"}]); // fails
test([[0,0],[0,1],[1,0]]); // fails

The error message is

Uncaught TypeError: Cannot read property 'toString' of undefined(โ€ฆ)
n @ jsnetworkx.js:1
d @ jsnetworkx.js:3
s @ jsnetworkx.js:3
b @ jsnetworkx.js:3

Note, that the code will work when allPairsDijkstraPath is replaced with allPairsShortestPath.

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.