A simple graph pre-processing library.
Use C++11 or newer.
There’s no other dependency if you just use it as a library for your own project.
There’re three ways to intergrate the library into your own project.
Clone, build and install the library:
git clone https://github.com/yhzhoucs/graph-tool.git
cd gtool
mkdir build
cmake -S . -B build -G "Ninja Multi-Config"
cmake --install ./build --config Release --prefix path/to/install
Import it in your CMakeLists.txt:
add_executable(Foo main.cpp)
find_package(gtool CONFIG REQUIRED PATHS path/to/install)
target_link_libraries(Foo PRIVATE gtool::gtool)
A packaged gtool is in Release area. Download and extract it to the library directory in your system. Follow the Import step above.
Also, you can have cmake to download it and import it automatically:
# fetch dependency
include(FetchContent)
FetchContent_Declare(
gtool
URL https://github.com/yhzhoucs/graph-tool/releases/download/v0.1.0/gtool-0.1.0-win64.tar.gz
URL_HASH MD5=5AAB4B1149610578FDC4D4952DE49080
)
FetchContent_MakeAvailable(gtool)
add_executable(Foo main.cpp)
# add my graph processing library
find_package(gtool CONFIG REQUIRED PATHS ${gtool_SOURCE_DIR})
if (gtool_FOUND)
message(STATUS "Critical library `gtool` found.")
target_link_libraries(Foo PRIVATE gtool::gtool)
else ()
message(FATAL_ERROR "The essential library `gtool` is not found.")
endif ()
Clone it to the third-party dependency directory such as
extern/
. Import it directly in your CMakeLists.txt:
add_executable(Foo main.cpp)
add_subdirectory(extern/gtool)
target_link_libraries(Foo PRIVATE gtool)
This approach is not recommended because the target namespace is mixed up. This may cause collisions.
Check Quick Start.
Follow the procedure below:
mkdir build
cmake -S . -B build -G "Ninja Multi-Config" -DENABLE_BUILD_DEMO=ON
cmake --build ./build --config Release
./build/Release/demo1 ./dataset/soc-Slashdot0811.txt
./build/Release/demo2 ./dataset/soc-Slashdot0811.txt
Clone this library and modify the code as you want.
You may want to use CTest. This project relies on Catch2 to finish all the tests. Check the tests directory. Remember to enable it by adding flag -DENABLE_BUILD_TEST=ON.
As the restoration to the basic graph is costly, this part of code is
excluded in the source code. But you can enable it by add the
compile option: -DBUILD_WITH_RESTORE. See CMakeLists.txt
in the
project root for more details.