Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Task2() {
- map<string, int> outDegrees; // Полустепень исхода
- map<string, int> inDegrees; // Полустепень захода
- for (auto vertex : AdjList) {
- outDegrees[vertex.first] = 0;
- inDegrees[vertex.first] = 0;
- }
- for (auto vertex : AdjList) {
- string v1 = vertex.first;
- for (auto edge : vertex.second) {
- string v2 = edge.first;
- outDegrees[v1]++;
- inDegrees[v2]++;
- }
- }
- cout << "Вершины с полустепенью исхода больше полустепени захода:\n";
- for (auto vertex : outDegrees) {
- string v = vertex.first;
- if (outDegrees[v] > inDegrees[v]) {
- cout << "Вершина " << v << " (" << outDegrees[v] << ", " << inDegrees[v] << ")\n";
- }
- }
- cout << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement