Comments (5)
I'm not sure whether an integration would be the right approach. I think the easiest thing to do is have a converter function which converts a graph into an object of the format sigmajs expects. Have a look at https://github.com/fkling/JSNetworkX/blob/master/jsnx/convert.js#L202 for example. It really should be difficult.
But if you had seamless integration in mind, such that adding a node to the graph also updates the visualization, I don't know if that's even possible. I'd have to have a look first how sigmajs works.
from jsnetworkx.
In what sense does the current drawing support demonstrate a "close integration" and to what extent is it a packaging of a graph into the format the drawing library supports?
Thinking about something like rCharts, which provides a generic R wrapper for a variety of js charting libraries, selecting an "integrated" chart library would mean you could as a user define a JSnetworkx library, specify the chart library type, and then "just" render the output display?
from jsnetworkx.
First of all, I think sigmajs and JSNetworkX try to solve the same problem: Visualize graphs. On top of that, JSNetworkX also provides the means to model and process graphs.
In what sense does the current drawing support demonstrate a "close integration" and to what extent is it a packaging of a graph into the format the drawing library supports?
JSNetworkX actually uses its own drawing solution, built on top of D3.js and SVG. Both are really low level parts and JSNetworkX adds the glue to handle graph specific logic. Neither D3 nor SVG know what a graph is.
It is tightly integrated because the drawing solution expects JSNetworkX graph objects as input and is built around the graph API. That makes it possible, for example, to more efficiently update visualizations when the graph changes.
Don't get me wrong, I love the idea to be able to use other existing visualization solutions with JSNetworkX. I'm just thinking about what would be the best way to do that.
For example, I started working on a more generic drawing API, so that I can use different rendering engines to visualize a graph, e.g. WebGL instead of SVG. And this works fine because those engines don't provide any logic for graphs on their own.
But it somehow doesn't feel right to hide a full-fledged graph drawing API behind JSNetworkX's own API. That's why I think, having a function that simply converts a JSNetworkX graph to sigma.js' input format might be sufficient... for now. If more features are desired, so that for example the visualization is automatically updated when the JSNetworkX graph object is changed, then we surely need more logic to make that happen, at which point an actual support for sigma.js on side of JSNetworkX makes sense.
But in general, JSNetworkX can be already used with any graph visualization library out there, as long as a graph can be converted to the desired input format. The best thing (for JSNetworkX) would be if the visualization libraries themselves would add support for JSNetworkX graph objects.
I also understand that something like rCharts is desirable, but I don't think that this is the role of JSNetworkX. It could be another project which connects JSNetworkX graphs (and other graphs) with those libraries. Making JSNetworkX feature complete is already work enough (especially, and unfortunately, given my little time), maintaining compatibility with X different visualization libraries would be too much. I'm very happy to support such an effort though, if anyone wants to tackle this :)
from jsnetworkx.
"That's why I think, having a function that simply converts a JSNetworkX graph to sigma.js' input format might be sufficient"
Yes - agreed; in networkx, http://networkx.lanl.gov/reference/readwrite.json_graph.html returns serialised data that I have plugged directly into visualisations built on top of d3.js demos.
I guess it's a design issue as to whether third party libraries should accept JSNetworkX graphs or whether JSNetworkX should support export plugins to handle data transformations into graph representations used by the third party libraries. (I wonder, is there standardisation work going on around graph representations in JSON?).
Re: the rCharts approach - that is, maybe, another project. There is already an rMaps effort, so maybe there's an opportunity for rGraphs too!
from jsnetworkx.
Closing this now. nodes()
and edges()
provide an easy way to "extract" the graph data. For example, one could do
var data = {
nodes: G.nodes(),
edges: G.edges()
};
// Really need JSON?
var json = JSON.stringify(data);
from jsnetworkx.
Related Issues (20)
- Include jsnetworkx.js into Jupyter Hub?
- having trouble visualizing in a browser
- Edge labels are missing
- How add jsnetworkx to ionic project?
- Dynamic node addition
- How can I visualize MultiGraph?
- Editing Nodes and Edges of graph HOT 2
- Add Typings
- dijkstraPath weight
- Is there an algorithm to return all possible paths to one target?
- Add weights to edges
- Lodash 3.10.1 in dependencies has a security issue HOT 1
- relabelNodes doesn't update the graph HOT 1
- Load a graph (of 500k nodes) from a file? HOT 1
- [Critical] Typo in variable name due to which edge weights don't work HOT 2
- Felix are you still working on this? HOT 3
- Fix part of nodes programmatically HOT 1
- Label for edges HOT 1
- Exporting graph to JSON
- Add Layout to the Visualization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsnetworkx.