如何将自定义图形适配到升级图库模板? [英] How to fit a custom graph to the boost graph library template?

查看:110
本文介绍了如何将自定义图形适配到升级图库模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对C ++模板生锈,我使用boost图库(致命的组合)。我搜索了网络,没有找到任何直接的指导如何采取一个自定义图形结构和足够的BGL(boost图库),我可以使用boosts图的遍历算法。任何熟悉图书馆的人都可以帮助我。

I'm rusty on C++ templates and I'm using the boost graph library (a fatal combination). I've searched the web and can't find any direct instructions on how to take a custom graph structure and fit enough of it to BGL (boost graph library) that I can use boosts graph traversing algorithms. Anyone familiar enough with the library to help me out?

编辑:所以,我一直在使用的主要问题是找到一个源,任意图形到BGL图形。我真的很新的模板,所以我很难阅读BGL的规范/示例。也许我应该寻找模板上的一般来源?

So, the main problem I've been having is where to find a source where the total requirements to map an arbitrary graph to a BGL graph. I'm really new to templates so it's hard for me to read BGL's specification/examples. Maybe I should look for a general source on templates?

推荐答案

我的建议是完全放弃使用BGL,除非你已经大量的代码写在它的顶部。我最近在一个大图分析项目上使用它,我发现它几乎是不可用的,因为一个过于复杂和设计不佳的API。

My suggestion would be to abandon use of BGL entirely unless you already have a significant amount of code written on top of it. I was testing it out recently for future use on a large graph analysis project, and I found it to be almost unusable due to an overly complex and poorly designed API.

在BGL中不是简单的任务,只有复杂的,我不断地与编译器打交道,因为BGL有过于复杂的模板层次。很少甚至没有有用的文档(至少不是真正需要的地方)和没有足够的例子只会加重事情。

There are no simple tasks in BGL, only complex ones, and I was constantly fighting the compiler due to the excessively complicated template hierarchy that BGL has. Little to no useful documentation (at least not where it's really needed) and not enough examples only aggravate matters. That's no way to write code.

我建议您切换到 LEMON 。它是稳定的,用C ++编写,易于理解和代码,提供了几种特殊形式的图形来支持不同的使用需求,它支持BFS和DFS搜索/访问者功能。它也有自己的等价的属性映射的节点/边缘,所以你应该能够适应你自己的图形结构和其他数据到它上面。

I'd recommend switching to LEMON. It's stable, written in C++, easy-to-understand and code in, offers several specialized forms of graphs to support different usage needs, and it supports both BFS and DFS search/visitor functions. It also has its own equivalent of property maps for nodes/edges, so you should be able to fit your own graph structure and other data onto it.

尝试LEMON;它味道好多了,会造成较少的溃疡。 ; - )

Try LEMON; it tastes a lot better and will cause fewer ulcers. ;-)

这篇关于如何将自定义图形适配到升级图库模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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