Javascript定向非循环图库? (图形可视化不是必需的) [英] Javascript directed acyclic graph library? (Graph visualization is NOT necessary)

查看:113
本文介绍了Javascript定向非循环图库? (图形可视化不是必需的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据集,最好用图表表示。它由具有有向边的6或7种不同类型的节点组成(相互依赖,保证不具有循环依赖性)。该数据集本质上是一个分层配置的模板,用户需要能够从不同层次选择想要的配置的位和片段,并且自动引入相关位。

一般用户界面需求是让用户从多选框中选择或取消选择项目(每个节点类型一个这样的框),并且具有开时,其他框中的项目将根据需要变为选中状态或取消选中状态。我需要能够从服务器上拉下数据集,让用户选择所需的位(在客户端用JavaScript进行依赖性处理以实现响应),然后在完成时将结果提交回去。 / p>

数据集非常庞大且复杂,实际将其显示为图形会让用户感到压抑和困惑。只需要基本的图遍历操作,因为所需的只是将依赖关系中的选择级联。 (例如,如果用户没有选择一个节点,将会导致节点依赖关系在没有其他选择节点仍然依赖它们的情况下变为未被选择,用户选择一个节点会导致该节点的所有依赖关系被选中)。简单的深度或宽度首次搜索从起始节点沿着有向边沿就足以访问所有受影响的节点。如果我可以跟随边缘的任何方向,奖金。 (如果不是,我可以轻松生成边缘反转图并在需要时使用它)。

我已经在这里挖掘并找到了对一些javascript图形可视化的引用图书馆,但大多数这些讨论似乎将图表解释为图表,我在这里没有图表需求。我的挖掘把我引向了这个列表:拉斐尔,原型,flare,D3,jsVis,Dracula和prefuse。从这个列表中看,如果我忽略可视化方面,jsVis或Dracula可能具有我需要的基础图形构造,但从文档中我不清楚这是否是这种情况。我不得不排除其他一些因为我无法引入任何闪存依赖项。不幸的是,我没有时间用这么多的库来创建原型。 (尽管我会挖掘jsVis和德古拉,除了这里的一些方便的输入。)



如果任何人有经验与列表中的东西,并认为图的部分它可以独立于可视化部分使用,这一定会满足我的需求。如果有一些其他图书馆可以满足我的需求,那也是很棒的。关于许可的最后一项要求是:图书馆需要以非copyleft的方式免费 - 所以理想情况是Apache v2.0,BSD,MIT或类似的东西。

h2_lin>解决方案

我还没有使用它,但您可能想查看 data.js 。这是一个拥有一系列数据结构工具的MIT许可证库。特别是,它包含 Data.Node Data.Graph


Data.Graph可用于表示任意复杂的对象图。对象之间的关系通过指向被引用对象的链接来表达。 Data.Graphs可以以各种方式遍历。



I have a dataset which is best represented by a graph. It consists of nodes of 6 or 7 different "types" with directed edges (dependencies on one another, guaranteed not to have cyclic dependencies). The dataset is essentially a template of a layered configuration, and the user needs to be able to select bits and pieces of the configuration from different layers which are desired, and have the dependent bits be brought in automatically.

The general UI need is for a user to select or un-select items from multi-select boxes (one such box for each node type), and have "depended-on" items in the other boxes become selected or unselected as needed. I need to be able to pull down the dataset from the server, let the user select the desired bits (with the dependency processing being done in javascript on the client side for responsiveness), and then submit the result back when they are finished.

The dataset is large and complex enough that actually showing it as a graph would be overwhelming and confusing to the user. Only basic graph traversal operations are needed, since all that is required is to cascade selections out the dependencies. (For example, a user un-selecting a node would result in that nodes dependencies becoming unselected if there were no other selected node which still depended on them. A user selecting a node would result in all of that node's dependencies becoming selected.) A simple depth or breadth first search following directed edges from the start node will suffice to visit all affected nodes. If I can follow edges either direction, bonus. (If not I can easily generate an edge-reversed graph and use that when needed.)

I have dug around on here and found references to a number of javascript graph visualization libraries, but most of these discussions seem to interpret "graph" as "chart" and I have no charting needs here. My digging has led me to this list: Raphael, protovis, flare, D3, jsVis, Dracula, and prefuse. From this list it looks like jsVis or Dracula might have the underlying graph constructs I need if I just ignore the visualization side, but it isn't clear to me from the documentation if that is the case. I have to rule out a few others because I cannot bring in any flash dependencies. Unfortunately I don't have time to prototype things with this many libraries. (I will be digging into jsVis and dracula more though, barring some handy input here.)

If anyone has experience with something from that list and believes that the graph portion of it can be used independently of the visualization portion, that will certainly meet my needs. If there is some other library I could use that meets my needs, that would be great too. One final requirement regarding licensing: the library needs to be "free" in a non-copyleft way - So ideally Apache v2.0, BSD, MIT, or something like that.

解决方案

I haven't used it, but you might want to check out data.js. It's an MIT-licensed library with a range of data-structure utilities. In particular, it includes Data.Node and Data.Graph:

A Data.Graph can be used for representing arbitrary complex object graphs. Relations between objects are expressed through links that point to referred objects. Data.Graphs can be traversed in various ways.

这篇关于Javascript定向非循环图库? (图形可视化不是必需的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆