开发者

Boost Graph Library dynamic edges weights

开发者 https://www.devze.com 2023-04-11 06:45 出处:网络
I\'m wondering if it\'s possible to make dynamic edges weights in BGL? I\'m writing public transport navigator so except time as weight it would be nice if I开发者_JAVA百科 can promote actualy using l

I'm wondering if it's possible to make dynamic edges weights in BGL? I'm writing public transport navigator so except time as weight it would be nice if I开发者_JAVA百科 can promote actualy using line instead of change at every stop event if it would be 3 minutes faster - this is just inconvenient.

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; 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)...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号