Returns a vector of node names in 'graph', sorted by name.
| 710 | |
| 711 | // Returns a vector of node names in 'graph', sorted by name. |
| 712 | std::vector<string> GraphNodes(const Graph& graph) { |
| 713 | std::vector<string> nodes; |
| 714 | for (const auto& node : graph.nodes()) { |
| 715 | if (!node->IsSource() && !node->IsSink()) { |
| 716 | nodes.push_back(node->name()); |
| 717 | } |
| 718 | } |
| 719 | std::sort(nodes.begin(), nodes.end()); |
| 720 | return nodes; |
| 721 | } |
| 722 | |
| 723 | // Returns a sorted vector of (src, dst) edges in 'graph'. |
| 724 | std::vector<std::pair<string, string>> GraphEdges(const Graph& graph) { |