交互式图形可视化 [英] Interactive graph visualisation

查看:23
本文介绍了交互式图形可视化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似于这个问题,我正在寻找一种方法来创建一个GUI,用户可以在其中查看图形(在 图形理论 意义上)并与之交互.随着时间的推移,车辆将在图表上从无移动到节点.用户应该能够添加节点和边,添加车辆并设置目的地.

Similar to this question, I'm looking for a way to create a GUI where users are able to see a graph (in the graph theory sense) and interact with it. Vehicles will move across the graph from none to node over time. Users should be able to add nodes and edges and add Vehicles and set their destination.

我已经实现了底层图形模型和业务逻辑,我只需要一个 GUI.这意味着我不需要诸如 Djistra 算法之类的图算法功能.

I have already implemented the underlying graph model and business logic, I just need a GUI for it. This means that I do not need graph algorithm functionality such as Djistra's algorithm.

如果可能,解决方案应该与平台无关.底层模型是用 python 编写的,所以 GUI 解决方案要么需要基于 python(这将是可取的),或者应该很容易与 python 接口(可能是 IPC).

If possible, the solution should be platform independent. The underlying model is written in python, so the GUI solution either needs to be python based (which would be preferable), or should easily interface with python (potentially IPC).

性能是一个问题.它不需要非常快,但它必须足够快以跟上底层模型.从理论上讲,图中可能存在的节点、边和车辆的数量没有限制.

Performance is a concern. It doesn't need to be blindingly fast, but it must be fast enough to keep up with the underlying model. Notionally, there is no limit on the number of nodes, edges and vehicles which may be present in the graph.

我查看了各种可视化库:

I have looked at various visualisation libraries:

我曾考虑使用 OpenGL.

我曾想过直接向 wxPython 绘图.

I have thought about drawing straight to wxPython.

我没有使用过任何图形库.我不知道他们是否能够提供所需的功能.例如,matplotlib 在图库中似乎有很多非图论图.除了通过 NetworkX 之外,我找不到其他人用它实现图形的例子.再举一个例子,NetworkX 可以绘制沿边缘移动的对象吗?

I haven't used any of the graph libraries. I don't know if they are capable of providing the required functionality. For example, matplotlib appears to have a lot of non graph-theory graphs in the gallery. I can't find an example of someone implementing a graph with it aside from through NetworkX. For another example, can NetworkX plot objects travelling along edges?

OpenGL 解决方案几乎肯定需要更多时间来实施.我必须自己编写用于跨边缘移动对象的函数.我必须编写一个函数来在正确的位置绘制边,并为所有边、节点和车辆等绘制标签.我需要从头开始实现菜单和处理交互.

An OpenGL solution would almost certainly take more time to implement. I would have to code functions for moving objects across edges myself. I would have to code a function for drawing the edges in the right place, and drawing labels for all of the edges and nodes and vehicles etc. I would need to implement menus and handle interactions from scratch.

我不确定我将如何在 wxPython 中实现它.我只知道如何将它与标准小部件结合使用.更新:我发现了这个问题 有一个指向 wx.lib.ogl 的答案wx.lib.floatcanvas 作为一种在纯 wxPython 中实现解决方案的机制.

I'm not sure how I would go about implementing this in wxPython. I only know how to use it in conjunction with standard widgets. Update: I found this question which has an answer which points to wx.lib.ogl or wx.lib.floatcanvas as a mechanism for implementing a solution in pure wxPython.

是否有任何可视化库满足我的要求?在那些这样做的情况下,哪些最适合?我是否错过了其他符合我要求的图书馆?像 JGraph 之类的东西,但对于 Python 而不是 Java 来说是合适的.

Do any of the visualisation libraries meet my requirements? Of those that do, which are most suited? Are there other libraries I have missed which would meet my requirements? Something like JGraph but for Python instead of Java would be suitable.

对于在 OpenGL 或 wxPython 中实现这一点而不是这些库之一,您有什么看法?

What is your opinion on implementing this in OpenGL or wxPython as opposed to one of these libraries?

还有其他我认为不合适的方法吗?

Are there other approaches I haven't considered that you think would be appropriate?

推荐答案

我最终发现我考虑的可视化库无法为沿边缘移动的对象设置动画.

I ended up finding that the visualisation libraries that I considered were not able to animate objects travelling along edges.

我对 wxPython 及其 floatcanvas 进行了试验,发现使用起来相当简单(比 OpenGL 解决方案简单得多).这让我可以根据需要自由地制作动画,但没有给我任何关于显示连接节点的包装器 - 我必须自己编写.

I experimented with wxPython, and its floatcanvas, and found that fairly straight forward to use (substantially simpler than the OpenGL solution would have been). This gave me the freedom to animate as I needed, but didn't give me any wrappers around displaying connected nodes - I had to write that myself.

这是一个很老的问题,所以现在可能有其他图书馆可以满足这个要求,或者可能是我认为的图书馆已经先进并且现在可以做到这一点.如果我今天必须从头开始实现它,我会倾向于尝试基于 Web 的 UI,可能会利用 Web 套接字在数据速率方面跟上后端.我不知道动画的缩放效果如何 - 我发现 Canvas 和 SVG 在一次为大量事物设置动画时会变得不稳定.也许 WebGL 更适合.

This is quite an old question, so there may be other libraries out there now that fulfil this requirement, or it might be that the libraries I considered have advanced and can now do this. If I had to implement it from scratch today, I would be inclined to experiment with a web based UI, potentially utilising web sockets to keep up with the back end in terms of data rate. I don't know how well the animation would scale though - I've found Canvas and SVG get choppy when animating large numbers of things at once. Maybe WebGL would suit better.

这篇关于交互式图形可视化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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