.NET 中有哪些选项可用于有向图或无向图的布局?

发布于 2024-07-14 09:06:26 字数 695 浏览 13 评论 0 原文

这里的“图表”是指类似于这些图像的东西:

理想的解决方案是:

  • 仅使用托管代码
  • 允许输出到位图图像
  • 允许输出到 WPF 元素,
  • 包括某种用于显示图形的交互式表面,支持缩放、平移和节点重组

我也有兴趣了解可能用作此类工作起点的项目。 如果需要一些发展才能实现我想要的目标,那么我准备好解决它。 该目标最复杂的部分似乎是在合理的时间范围内获得图形布局。

By graph here I mean something resembling these images:



The ideal solution would:

  • use only managed code
  • allow output to a bitmap image
  • allow output to WPF elements
  • include some kind of interactive surface for displaying the graph that supports zooming, panning and reorganisation of nodes

I'm also interested in hearing about projects that could potentially be used as the starting point for this kind of work. If it requires some development to achieve what I want, then I'm prepared to tackle it. The most complex portion of this goal seems to be obtaining the graph layout in a reasonable time frame.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

烟织青萝梦 2024-07-21 09:06:26

Graph# 也是另一种选择。 我个人没有使用过它,但我一直想抽出时间来看看。

Graph# is also another option. I haven't used it personally, but I've been meaning to get around to looking over it.

倾`听者〃 2024-07-21 09:06:26

微软研究院为.NET提供了一个名为MSAGL(自动图形布局,以前称为GLEE)的工具。

MSAGL 可在此处获取:http:// Research.microsoft.com/en-us/downloads/f1303e46-965f-401a-87c3-34e1331d32c5/default.aspx

免责声明:我没有使用过该工具,所以我不知道它是否适合您(我也不知道许可条件,似乎它仅适用于非商业应用)。 但至少看起来很有趣。

Microsoft Research provides a tool called MSAGL (Automatic Graph Layout, previously called GLEE) for .NET.

MSAGL is available here: http://research.microsoft.com/en-us/downloads/f1303e46-965f-401a-87c3-34e1331d32c5/default.aspx

Disclaimer: I haven't used the tool so I don't know whether it is suitable for you (and neither do I know about the licensing conditions, seems it is for non-commercial applications only). But at least it looks interesting.

过期以后 2024-07-21 09:06:26

我在 NDepend 团队工作,我确认:我们于 2008 年 9 月从 GraphViz 切换到 MsAgl,并且 MsAgl 许可证确实允许商业利用。 以下是 NDepend 中集成的 MsAgl 图 的一些示例图片(一切都是交互式的,节点是可移动的) /selectable/removable/clickable,边缘可编辑/selectable/removable/clickable,布局可缩放,而且,虽然它可能更干净,但 MsAgl API 足够干净,可以使用):

在此处输入图像描述
在此处输入图像描述
在此处输入图像描述

I am working in the NDepend team and I confirm: we switched from GraphViz to MsAgl in september 2008 and also the MsAgl license allows indeed commercial utilisation. Here are a few sample pictures of MsAgl graphs integrated in NDepend (everything is interactive, nodes are movable/selectable/removable/clickable, edges are editable/selectable/removable/clickable, the layout is zoomable, and also, while it could be cleaner the MsAgl API is clean enough to work with):

enter image description here
enter image description here
enter image description here

夜光 2024-07-21 09:06:26

在我看来,Graphviz 至今仍然是最好的图形库之一。 然而,将其集成到.Net 中是一件痛苦的事情。

可以调用命令行工具根据图形输入生成形状输出,然后读取输出并将元素放置在自定义控件上,该控件显示 graphviz 计算的任何形状。 这是非常 hacky 的,但这是我们团队几年前发现的将 graphviz 与 .Net 集成的最佳方式。

今天可能存在更好的解决方案; 那时 GLEE 还处于萌芽状态,从那时起我还没有看到微软取得的进展。

Graphviz is still today, in my opinion, one of the best graph library there is. However, integrating it to .Net is a pain.

It is possible to call the command line tool to generate a shape output based on your graph input, then you read the output and lay the elements on a custom control that displays whatever shapes graphviz has calculated. It's very hacky but it's the best way our team have found of integrating graphviz with .Net a few years ago.

A better solution might exist today; at that time GLEE was still very embrionic and I haven't seen the progress Microsoft did since that time.

痴者 2024-07-21 09:06:26

我使用过 NodeXL,http://www.codeplex.com/NodeXL,它是一个 .Net 3.5 库(也是 Excel 插件)。 NodeXl 由微软研究院开发,非常简洁:它具有可视化算法和一些指标,但仍处于开发的早期阶段。 如果您是一位经验丰富的 .Net 开发人员,那么我肯定会看看它。

但是,如果您了解 Python,那么我肯定会推荐 Networkx 及其表弟 pygraphviz,它是 Graphviz 的接口。 我使用过这两种方法,并且使用 Python / Networkx 时的工作效率比使用 NodeXL 时要高得多。

GLEE是微软的闭源库,你只能在非商业软件中免费使用,而NodeXL是微软的开源方式,但你可以在你开发的产品中免费使用它。

I have used NodeXL, http://www.codeplex.com/NodeXL, which is a .Net 3.5 library (but also an Excel add-on). NodeXl is developed by Microsoft Research and pretty neat: it has visualization algorithms and some metrics but it is still in its early stages of development. If you have are a seasoned .Net developer then I would definitely take a look at it.

However, if you know Python then I would definitely recommend Networkx and its cousin pygraphviz which is an interface to Graphviz. I have used both and my productivity with Python / Networkx is way higher then when I was using NodeXL.

GLEE is Microsoft's closed source library that you only can use for free in non-commercial software while NodeXL is Microsoft's way of open source but you can use it freely in a product you develop.

熊抱啵儿 2024-07-21 09:06:26

只是为了使选项列表完整: Graphviz4Net 是 Coincoin 在其答案中建议的开源实现。

Just to make the list of options complete: Graphviz4Net is open-source implementation of what Coincoin has suggested in his answer.

凯凯我们等你回来 2024-07-21 09:06:26

Mindscape 的男孩们有这样一个工具

,名字很富有想象力 WPF 流程图

另外,请查看 Vertigo 的 Family.Show 演示项目,它有一个简单的形式

The boys at Mindscape have such a tool

With the imaginative name WPF Flow Diagrams

Also, check out Vertigo's Family.Show demo project, it has a simple form of this

ま昔日黯然 2024-07-21 09:06:26

使用 QuickGraph 输出 GraphViz。 我在最近的一个项目中就是这样做的,看起来效果很好。 在此处查看用于解析 .plain 文件的示例代码,或使用我的项目 < a href="http://www.jamiepenney.co.nz/2009/02/viewing-dependency- Between-projects.html" rel="nofollow noreferrer">此处作为仅输出 .png 的参考图片。

Use QuickGraph to output Dot files for GraphViz. I did that in a recent project, and it seems to work quite well. Look here for sample code for parsing .plain files, or use my project here as a reference for just outputing .png images.

留一抹残留的笑 2024-07-21 09:06:26

我用过MsAgl,效果非常好。 它还具有 WinForms 和 WPF 的查看器,这对您可能重要也可能不重要。 人们不必使用查看器,因为它们与图形布局引擎的耦合非常松散。

它并不支持 Graphviz 所做的一切(特别是在某些形状类型方面)。 此外,文档还可以更好,但即使不是有史以来最精美的 MS 产品,它也相当可靠。

它确实勾选了您提到的所有要求项,尽管“在查看器上”重新组织仅支持拖动移动节点、重新路由边缘和重新定位标签。 该图表不会通过重新定位任何其他项目来响应这些元素的移动。

I have used MsAgl and it is pretty good. It also has viewers for both WinForms and WPF which may or may not be important to you. One does not have to use the viewers as they are quite loosely coupled to the graph layout engine.

It does not support everything that Graphviz does (notably in terms of some shape types). Also the documentation could be better but it is pretty solid if not the most polished MS product ever.

It does tick all of the items you mention as requirements, though the "on viewer" re-organization merely supports drag-moving nodes, re-routing edges and re-positioning labels. The graph does not respond to the movements of these elements by repositioning any other items.

追风人 2024-07-21 09:06:26

我用过这个 http://www.codeproject.com/Articles/484616/MVVM -Diagram-Designer 它是一个开源的,非常容易使用。
代码解释得很好。

I have used this http://www.codeproject.com/Articles/484616/MVVM-Diagram-Designer it's an open source one, really easy to use.
the code is explained really well.

追星践月 2024-07-21 09:06:26

它不是 .NET,但经常引用的用于渲染图形的工具包是 AT&T Graphviz。 我自己只使用过独立的应用程序,但源代码可以通过类似开源许可证的方式获得。

流行的代码文档工具 doxygen 使用 Graphviz 为其生成的文档自动绘制各种图表。

Its not .NET, but an often referenced toolkit for rendering graphs is AT&T Graphviz. I've only used the free-standing applications myself, but the source code is available under something resembling an open source license.

Graphviz is used by the popular code documentation tool doxygen to automatically draw various diagrams for its generated documentation.

ζ澈沫 2024-07-21 09:06:26

去年夏天,当我做一些涉及图形的工作时,我发现不太昂贵的最佳选择是在 SVG 中手动完成,即从一堆字符串写出 SVG 文件,并使用 Inkscape 将其渲染为图像。

这不是一个快速且简单的解决方案,但它确实允许近乎无限的定制,因此如果您必须组织图表或基于连接等进行空间组织,这可能会很好。

When I did some work involving graphs last summer I found the best option that wasn't overly expensive was to manually do it in SVG, i.e. write out an SVG file from a bunch of strings, and render that out to an image using Inkscape.

This is not a quick and easy solution, but it does allow for near-infinite customisation, so it might be nice if you have to organise the graphs or do spatial organisation based on connections etc.

醉生梦死 2024-07-21 09:06:26

Northwoods 在其 GoLayout 产品。 它们提供树、力导向和分层有向图(这不完全是 Sujiyama 效应,但对于许多(如果不是大多数)数据集来说也相差不远)。 1790 美元/位,很贵。 还有一些限制:最重要的是,它们的实现是为“人类可读”的图形而设计的。 我给它提供了超过 5,000 个节点的数据集,没有出现任何问题,但我也可以生成少于 500 个节点的数据集,导致它出现堆栈溢出(递归太深)。 根据您的领域,它可能(或可能不)适合。 如果您需要一个处理任何数据集的通用布局包,我建议使用 GraphViz 而不是 Northwoods。

我尚未使用过他们的任何 WPF 功能,但我知道他们拥有这些功能。 我在 WinForms 领域使用他们的东西已经有一段时间了。

Northwoods offers a pure .NET solution in their GoLayout product. They offer tree, force directed, and layered digraph (which is not quite a Sujiyama effect, but not too far off for many if not most data sets). At $1790/seat it's expensive. There are also some limitations: most importantly, their implementations are designed for "human readable" graphs. I've given it data sets of over 5,000 nodes and had no issue, but I can also generate data sets of less than 500 nodes that cause it to have a stack overflow (recursing too deep). Depending upon your domain, it may (or may not) be a good fit. If you need a general layout package that handles any data set, I'd suggest GraphViz over Northwoods.

I have yet to use any of their WPF capabilities, but I know they have them. I've been using their stuff in WinForms land for a while.

清泪尽 2024-07-21 09:06:26

我一直在玩 GLEE/MSAGL,实际布局本身足以满足我的需要,但是我希望能够更多地控制节点内部的实际内容,而不是像现在这样仅使用单个值。

例如,我希望隐藏“详细信息”,直到单击节点中的扩展器,或者双击节点或用鼠标悬停。

假设 GLEE 无法做到这一点,现在是否有任何可用的纯 .NET 解决方案可以做到这一点?

I have been playing on GLEE/MSAGL and the actual layout per se is good enough for what I need however I'd like to be able to have more control over what is actually inside the nodes rather than just a single value like now.

For example I'd like to have "details" that are hidden until I click on an expander in the node, or double click the node or hover with the mouse.

Assuming GLEE cannot do this are there now any pure .NET solutions available that could do it?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文