@@ -117,7 +117,7 @@ void SubgraphDetector::MarkNodesInsideSubGraph() {
117117// Use the Union Find(UF) algorithm to find fully connected sub-graphs, if node
118118// a's output is node b, that is a and b is in the same sub-graph. The UF
119119// algorithm will group them to the same cluster.
120- using node_map_t = std::unordered_map <int , Node *>;
120+ using node_map_t = std::map <int , Node *>;
121121// Find the ancestor id of a node.
122122int UnionFindGetAncestor (const node_map_t &node_map, size_t id) {
123123 int tmp = id;
@@ -155,7 +155,7 @@ struct BriefNode {
155155// 3. change all the dst's inputs and outputs
156156// corresponding inlinks and outlinks to src node.
157157// 4. delete all dst's inlinks and outlinks.
158- void UnionContractedNodes (const std::unordered_map <int , BriefNode *> &node_map,
158+ void UnionContractedNodes (const std::map <int , BriefNode *> &node_map,
159159 int src_id, int dst_id) {
160160 // merge the two adjacent nodes into one node.
161161 BriefNode *src_node = node_map.at (src_id);
@@ -262,7 +262,7 @@ std::vector<std::vector<Node *>> SubgraphDetector::ExtractSubGraphs() {
262262 std::vector<Node *> marked_nodes;
263263 // We use brief_node_map to represent the original graph in order to avoid
264264 // changing the original graph.
265- std::unordered_map <int , BriefNode *> brief_node_map;
265+ std::map <int , BriefNode *> brief_node_map;
266266
267267 std::unordered_set<int32_t > valid_node_ids;
268268 for (auto *node : graph_->Nodes ()) {
0 commit comments