| 35 | namespace graph { |
| 36 | |
| 37 | void print(const std::set<El::Int>& nodes, |
| 38 | const std::map<El::Int, std::set<El::Int>>& edges, |
| 39 | std::ostream& os = std::cout) |
| 40 | { |
| 41 | for (const auto& node : nodes) { |
| 42 | os << "node " << node << " neighbors :"; |
| 43 | for (const auto& neighbor : get_neighbors(node, edges)) { |
| 44 | os << " " << neighbor; |
| 45 | } |
| 46 | os << "\n"; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | std::set<El::Int> |
| 51 | get_neighbors(El::Int node, const std::map<El::Int, std::set<El::Int>>& edges) |