-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
huanmie
committed
Jul 19, 2022
1 parent
6657227
commit c9980b6
Showing
4 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "x64-Debug", | ||
"generator": "Ninja", | ||
"configurationType": "Debug", | ||
"inheritEnvironments": [ "msvc_x64_x64" ], | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "" | ||
}, | ||
{ | ||
"name": "x64-Release", | ||
"generator": "Ninja", | ||
"configurationType": "RelWithDebInfo", | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "", | ||
"inheritEnvironments": [ "msvc_x64_x64" ], | ||
"variables": [] | ||
}, | ||
{ | ||
"name": "WSL-GCC-Debug", | ||
"generator": "Ninja", | ||
"configurationType": "Debug", | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeExecutable": "cmake", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "", | ||
"inheritEnvironments": [ "linux_x64" ], | ||
"wslPath": "${defaultWSLPath}", | ||
"variables": [] | ||
}, | ||
{ | ||
"name": "WSL-GCC-Release", | ||
"generator": "Ninja", | ||
"configurationType": "RelWithDebInfo", | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeExecutable": "cmake", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "", | ||
"inheritEnvironments": [ "linux_x64" ], | ||
"wslPath": "${defaultWSLPath}", | ||
"variables": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <limits> | ||
#include <numeric> | ||
#include <algorithm> | ||
#include <execution> | ||
#include <functional> | ||
#include <unordered_set> | ||
#include <unordered_map> | ||
#include "Graph.h" | ||
|
||
int main() | ||
{ | ||
Graph<std::string> graph{ | ||
{ "A", 9, "B" }, { "A", 5, "C" }, { "C", 2, "B" }, | ||
{ "A", 3, "D" }, { "B", 5, "D" }, { "D", 2, "C" }, | ||
{ "D", 2, "E" }, { "D", 5, "B" }, { "C", 4, "E" }, | ||
{ "B", 2, "F" }, { "F", 1, "E" }, { "C", 5, "F" }, | ||
}; | ||
graph.AddEdge("C", 3, "D"); | ||
auto out_path = graph.GetOutPath("C"); | ||
out_path.clear(); | ||
graph.RemoveEdge("C", "D"); | ||
graph.GetOutPath("C", [&out_path](auto&& new_path) {out_path.push_back(new_path); }); | ||
auto in_path = graph.GetInPath("B"); | ||
in_path.clear(); | ||
graph.GetInPath("B", [&in_path](auto&& new_path) {in_path.push_back(new_path); }); | ||
auto weight = graph.GetWeight("C", "D"); | ||
auto result = graph.GetBestPath("A", "E"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters