简体   繁体   English

Boost Graph Library动态边权重

[英]Boost Graph Library dynamic edges weights

I'm wondering if it's possible to make dynamic edges weights in BGL? 我想知道是否有可能在BGL中制作动态边缘权重? I'm writing public transport navigator so except time as weight it would be nice if I can promote actualy using line instead of change at every stop event if it would be 3 minutes faster - this is just inconvenient. 我正在写公共交通工具导航器,所以除了时间以外,如果我可以使用线路而不是在每次停车事件中进行更改(如果可以快3分钟)的话,那么我会进行宣传,那就太好了-这很不方便。

Thanks for your help 谢谢你的帮助

edit: Or maybe there is better library than can do that which I should use? 编辑:也许有比我应该使用的更好的库?

I'm not entirely clear on what you mean by dynamic... the weights are presumably stored in edge properties; 我不清楚您所说的动态是什么...权重可能存储在边缘属性中; there's nothing to stop you updating the properties with new values as required. 没有什么可以阻止您根据需要使用新值更新属性。

If you mean that you want the edge weights to be a function-object (or "functor", if you must) rather than "just a value", then see this thread on the BGL users list ; 如果您想让边缘权重成为函数对象(或者,如果需要,则为“ functor”),而不是“只是一个值”,那么请在BGL用户列表中查看此线程 haven't tried it myself. 我自己还没有尝试过 Makes me wonder how well various graph algorithms using edge weights deal with the weights changing while they're in progress (if the functor is called more than once and returns a different value each time)... 让我想知道各种使用边缘权重的图形算法在权重进行过程中如何处理权重变化(如果仿函数多次调用并且每次返回一个不同的值)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM