Returns a sorted vector of (src, dst) edges in 'graph'.
| 722 | |
| 723 | // Returns a sorted vector of (src, dst) edges in 'graph'. |
| 724 | std::vector<std::pair<string, string>> GraphEdges(const Graph& graph) { |
| 725 | std::vector<std::pair<string, string>> edges; |
| 726 | for (const Edge* edge : graph.edges()) { |
| 727 | if (edge->src()->IsSource() || edge->dst()->IsSink()) continue; |
| 728 | edges.emplace_back( |
| 729 | absl::StrCat(edge->src()->name(), ":", edge->src_output()), |
| 730 | absl::StrCat(edge->dst()->name(), ":", edge->dst_input())); |
| 731 | } |
| 732 | std::sort(edges.begin(), edges.end()); |
| 733 | return edges; |
| 734 | } |
| 735 | |
| 736 | TEST(EncapsulateSubgraphsTest, InputDeduplication) { |
| 737 | Scope root = Scope::NewRootScope().ExitOnError().WithDevice( |
no test coverage detected