早上好,
刚开始的真棒d3js库...
just starting with the awesome d3js library ...
只有具有力定向布局的图的一部分。这个想法是将一个节点声明为中心,并显示距离该中心节点两个(例如)距离内的所有节点,中心节点的邻居和邻居的邻居。如果用户点击显示的节点之一,则它变成新的中心节点并且显示不同的子图。我不知道是否有一个关于实现这种子图布局的示例,如果某种类型的节点距离算法已经在d3js中实现。
I want to show only a portion of a graph with the force directed layout. The idea is to have one node declared as the "center" and show all nodes within a distance of two (for example) from this center node, the neighbors of the center node and the neighbors of the neighbors. If the user clicks on one of the displayed nodes it becomes the "new" center node and a different "subgraph" is displayed. I wonder if there is an example around implementing this kind of subgraph layout and if some kind of a "node-distance" algorithm is already implemented in d3js.
非常感谢
martin
:只是找到了示例修改强制布局,其中阐明了如何添加和删除节点和边缘从力导向的布局。
UPDATE: Just found the example Modifying a Force Layout which illuminates how to add and remove nodes and edges from a force directed layout.
推荐答案我刚刚上传了一个互动力量导向子图的概念证明级别。
I just uploaded a "proof of concept level" of an interactive force directed subgraph.
http://justdharma/d3/sub-graph/
在本例中,我使用了backbonejs。作为我第一次使用backbonejs实现一些东西,我肯定以非常粗暴的方式使用它。虽然这个例子可以说明如何实现一个交互式子图表,但它是肯定不是一个模板如何做到 - 只是一个概念的证明hack ...
In this example I use backbonejs under the hood. Being the first time I implement something with backbonejs, I for sure use it in a very crude manner. While this example might illuminate one way how an interactive sub-graph can be achieved it is for sure not a template how to do it - as said just a proof of concept hack ...
更多推荐
D3.js强制布局
发布评论