From a81b7a24a69ac0a01fd50b92c708951e2b8995d7 Mon Sep 17 00:00:00 2001 From: fonsinchen Date: Sun, 10 Jul 2016 12:03:23 +0000 Subject: [PATCH] (svn r27613) -Codechange: Use a flat vector instead of a map in FlowEdgeIterator. (JGR) --- src/linkgraph/mcf.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/linkgraph/mcf.cpp b/src/linkgraph/mcf.cpp index 10296575c0..ecdf792afe 100644 --- a/src/linkgraph/mcf.cpp +++ b/src/linkgraph/mcf.cpp @@ -136,7 +136,7 @@ private: LinkGraphJob &job; ///< Link graph job we're working with. /** Lookup table for getting NodeIDs from StationIDs. */ - std::map station_to_node; + std::vector station_to_node; /** Current iterator in the shares map. */ FlowStat::SharesMap::const_iterator it; @@ -152,7 +152,11 @@ public: FlowEdgeIterator(LinkGraphJob &job) : job(job) { for (NodeID i = 0; i < job.Size(); ++i) { - this->station_to_node[job[i].Station()] = i; + StationID st = job[i].Station(); + if (st >= this->station_to_node.size()) { + this->station_to_node.resize(st + 1); + } + this->station_to_node[st] = i; } }