How to fit a custom graph to the boost graph library template?

前端 未结 2 467
鱼传尺愫
鱼传尺愫 2021-02-06 01:05

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

2条回答
  •  无人及你
    2021-02-06 01:19

    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.

    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.

    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.

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

提交回复
热议问题