[jgrapht-users] Suggestions for "shortest path with conditional nodes"?
Brought to you by:
barak_naveh,
perfecthash
From: <org...@io...> - 2015-04-12 14:17:44
|
Hello. I'm modelling an abstract network. The network is represented by a simple undirected graph (SimpleGraph, specifically). Vertices in the graph represent networked devices, and the edges represent hardwired network links. I calculate routes in the network using DijkstraShortestPath. This all works very well, but I'd now like to model nodes being optionally on/off. If a node is "off", then it should be considered a dead end when calculating routes. In other words, if a node is "off", then it should be routed around if possible. Does anyone have any suggestions as to how to get the shortest paths when some nodes should conditionally be considered "invisible"? In order to keep the code that deals with graphs simple, and because the edges in the graph represent hardwired links, I don't really want to remove vertices/edges when a node is switched off - the edges carry a meaning beyond simply whether or not a packet can be routed that way. Right now, I'm leaning towards maintaining two graphs (one with the physical links, the other with only the active nodes and links), but I'd rather not do this as it obviously requires keeping two mutable data structures synchronized. M |