(svn r25885) -Codechange: Keep paths sorted so that the ones with flow == 0 are in the back and don't have to be iterated over so often.

This commit is contained in:
fonsinchen
2013-10-19 17:15:19 +00:00
parent f16b78eb81
commit 6580fd4b8f
4 changed files with 28 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ private:
*/
struct NodeAnnotation {
uint undelivered_supply; ///< Amount of supply that hasn't been distributed yet.
PathList paths; ///< Paths through this node.
PathList paths; ///< Paths through this node, sorted so that those with flow == 0 are in the back.
FlowStatMap flows; ///< Planned flows to other nodes.
void Init(uint supply);
};
@@ -234,7 +234,8 @@ public:
const FlowStatMap &Flows() const { return this->node_anno.flows; }
/**
* Get the paths this node is part of.
* Get the paths this node is part of. Paths are always expected to be
* sorted so that those with flow == 0 are in the back of the list.
* @return Paths.
*/
PathList &Paths() { return this->node_anno.paths; }