Javascript有向无环图库?(不需要图形可视化) [英] Javascript directed acyclic graph library? (Graph visualization is NOT necessary)

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

问题描述

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

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.

一般的 UI 需求是让用户从多选框(每个节点类型一个这样的框)中选择或取消选择项目,并在其他框中选择或取消选择依赖"项目需要.我需要能够从服务器下拉数据集,让用户选择所需的位(在客户端的 javascript 中进行依赖处理以实现响应),然后在完成后将结果提交回来.

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.)

我在这里挖掘并找到了对许多 javascript 图形可视化库的引用,但这些讨论中的大多数似乎将图形"解释为图表",我在这里没有图表需求.我的挖掘使我找到了这个列表:Raphael、protovis、flare、D3、jsVis、Dracula 和 prefuse.从这个列表看来,如果我只是忽略可视化方面,jsVis 或 Dracula 可能具有我需要的底层图形结构,但如果是这种情况,我从文档中不清楚.我必须排除其他一些,因为我无法引入任何 Flash 依赖项.不幸的是,我没有时间用这么多库来制作原型.(我将更多地研究 jsVis 和 dracula,除非这里有一些方便的输入.)

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.)

如果有人对该列表中的某些内容有经验并认为它的图形部分可以独立于可视化部分使用,那肯定会满足我的需求.如果我可以使用其他一些图书馆来满足我的需求,那也很棒.关于许可的最后一个要求:库需要以非左版方式免费" - 所以理想情况下是 Apache v2.0、BSD、MIT 或类似的东西.

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.

推荐答案

我没用过,但你可能想看看 data.js.它是一个 MIT 许可的库,具有一系列数据结构实用程序.特别是,它包括 Data.NodeData.Graph:

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:

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天全站免登陆