在 C++ 中实现和使用节点图的方法?
我正在开展一个涉及社交网络的研究项目。我已经用 C++ 完成了程序的大部分主干,现在想要实现一种创建节点和连接图的方法以及可视化人与人之间的连接的方法。我对 Lemon 和 Boost 图形库进行了一些研究,但想知道哪一个更容易学习和实现,或者我是否应该编写自己的代码。
I am working on a research project that deals with social networks. I have done most of the backbone of the program in C++ and am now wanting to implement a way to create the graph of nodes and the connections as well as a way to visualize the connections between people. I have looked a little into Lemon and the Boost graph library, but was wondering which one would be easier to learn and implement or if I should just code my own.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 BGL 那么您应该还可以使用算法和绘图图形工具包 (GTAD)。 GTAD 旨在与 BGL 兼容,并添加了许多 BGL 中没有的图形算法以及布局算法。
对于可视化,BGL 允许您读取和写入一些常见的图形文件类型,例如 GraphML 和 Dot,以便与 GraphViz。
Lemon 看起来是一个功能齐全的库,拥有一系列良好的算法。您还可以使用 gLemon 查看 Lemon 图表。不过,这个可视化工具看起来相当基础,最后一次更新是在 2008 年,与仍在开发中的 Lemon 不同。
我建议您首先弄清楚您想要对您创建的任何图形执行什么操作,即您需要什么算法(最短路径等),然后从这方面比较两个库。
另请查看两者的教程。他们有非常好的文档,应该可以帮助您决定哪个更容易实施。
除非您真的想详细了解某些图结构和算法的实现方式,否则我会使用库。
If you use the BGL then you should also be able to make use of the Graph Toolkit for Algorithms and Drawings (GTAD). The GTAD is meant to be compatible with BGL and adds a number of graph algorithms not in BGL as well as algorithms for layouts.
For visualization the BGL allows you to read and write some common graph file types such as GraphML and Dot for use with GraphViz.
Lemon looks to be a well featured library with a good array of algorithms. You can also use gLemon to view Lemon graphs. This visualizer looks quite basic though and was last updated in 2008, unlike Lemon which is still under development.
I would suggest you first work out what you want to do with any graphs you create, ie what algorithms you require (shortest-path etc) and compare the two libraries from that respect.
Also take a look at the tutorials for both. They have very good documentation and should help you decide which you'll find easier to implement.
Unless you really want to get into the details of how certain graph structures and algorithms are implemented I would use a library.