Comments (5)
Did your message get clipped?
from d3-network.
Sorry, I submitted the issue by accident before I finished it. I have updated it.
from d3-network.
I see your point! So actually I did this to follow the d3 convention. According to the documentation, the values of 'source' and 'target' may be initialized with the index of the node in the node array (and in fact our backend remaps the ids to accommodate this):
Note: the values of the source and target attributes may be initially specified as indexes into the nodes array; these will be replaced by references after the call to start. Link objects may have additional fields that you specify; this data can be used to compute link strength and distance on a per-link basis using an accessor function.
The d3 force layout code actually does this exact binding:
for (i = 0; i < m; ++i) {
o = links[i];
if (typeof o.source == "number") o.source = nodes[o.source];
if (typeof o.target == "number") o.target = nodes[o.target];
++o.source.weight;
++o.target.weight;
}
I bind the nodes explicitly because I need it before the force layout.
from d3-network.
Also, note that the only thing you would have to change is this:
genes_in = [ { id: 123, name: "foo" }, { id: 456, name: "bar" } ];
edges_in = [ { source: 0, target: 1, weight: 3.14} ];
from d3-network.
I got it. Thank you very much for the clarification.
from d3-network.
Related Issues (10)
- Network graph not shown HOT 9
- Support of Negative Edge Weight HOT 1
- Trailing spaces in d3.network.js HOT 1
- "options.start_edge" is undefined HOT 2
- degree calculation/rank sorting is incorrect
- Customize the starting and ending values of legend and its text HOT 25
- "mouseclick" Event Listener on Gene Circle HOT 7
- Legend text configuration HOT 2
- New feature request: Set both minimum and maximum edge cutoff values in filter() method HOT 2
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 d3-network.