Skip to content

Commit

Permalink
Merge branch 'master' into welsh_powell_coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
badumbatish committed Jan 23, 2024
2 parents f18cb1f + 87bee02 commit 823ef8f
Show file tree
Hide file tree
Showing 133 changed files with 6,663 additions and 5,081 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j
- name: Download previous benchmark data
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j
- name: Download previous benchmark data
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: clang-format Check

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'benchmark'
- 'examples'
- 'include/CXXGraph'
- 'test'
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '16'
check-path: ${{ matrix.path }}
2 changes: 1 addition & 1 deletion .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ jobs:

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand Down Expand Up @@ -80,6 +80,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/flawfinder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
output: 'flawfinder_results.sarif'

- name: Upload analysis results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{github.workspace}}/flawfinder_results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.9)

# set the project name and version
project(CXXGraph VERSION 3.0.0)
project(CXXGraph VERSION 3.1.0)

configure_file(CXXGraphConfig.h.in ${PROJECT_SOURCE_DIR}/include/CXXGraph/CXXGraphConfig.h)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ If you are interested, please contact us at [email protected] or contribute to
| :heavy_check_mark: | Release 1.1.0 | May 8, 2023 |
| :heavy_check_mark: | Stable Release 2.0.0 | Jun 1, 2023 |
| :heavy_check_mark: | Stable Release 3.0.0 | Nov 3, 2023 |
| :heavy_check_mark: | Release 3.1.0 | Jan 9, 2023 |
| :memo: | Introduce Hypergraph [#122](https://github.com/ZigRazor/CXXGraph/issues/122) | TBD |
| :memo: | Stable Release 4.0.0 | TBD |

Expand Down
2 changes: 1 addition & 1 deletion benchmark/BellmanFord_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ static void BellmanFord_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(BellmanFord_FromReadedCitHep);
BENCHMARK(BellmanFord_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/Boruvka_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ static void Boruvka_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Boruvka_FromReadedCitHep);
BENCHMARK(Boruvka_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/Connectivity_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ static void StrongConnectivity_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(StrongConnectivity_FromReadedCitHep);
BENCHMARK(StrongConnectivity_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/CycleCheck_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ static void CycleCheckDFS_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(CycleCheckDFS_FromReadedCitHep);
BENCHMARK(CycleCheckDFS_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/Dial_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ static void Dial_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Dial_FromReadedCitHep);
BENCHMARK(Dial_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/Edge_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ static void NodeGetNodePair(benchmark::State &state) {
e.getNodePair();
}
}
BENCHMARK(NodeGetNodePair);
BENCHMARK(NodeGetNodePair);
1 change: 1 addition & 0 deletions benchmark/FloydWarshall_BM.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <benchmark/benchmark.h>

#include <memory>

#include "CXXGraph/CXXGraph.hpp"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/FordFulkerson_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ static void FordFulkerson_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(FordFulkerson_FromReadedCitHep);
BENCHMARK(FordFulkerson_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/Kruskal_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ static void Kruskal_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Kruskal_FromReadedCitHep);
BENCHMARK(Kruskal_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/Node_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ static void NodeGetData(benchmark::State &state) {
n1.getData();
}
}
BENCHMARK(NodeGetData);
BENCHMARK(NodeGetData);
2 changes: 1 addition & 1 deletion benchmark/Partition_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ static void PartitionEBV_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(PartitionEBV_FromReadedCitHep);
BENCHMARK(PartitionEBV_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/Prim_BM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ static void Prim_FromReadedCitHep(benchmark::State &state) {
}
}

BENCHMARK(Prim_FromReadedCitHep);
BENCHMARK(Prim_FromReadedCitHep);
2 changes: 1 addition & 1 deletion benchmark/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <benchmark/benchmark.h>

BENCHMARK_MAIN();
BENCHMARK_MAIN();
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ add_subdirectory(DialExample)
add_subdirectory(DijkstraExample)
add_subdirectory(NetworkDynamicsExample)
add_subdirectory(PartitionExample)
add_subdirectory(PrimExample)
add_subdirectory(FloydWarshallExample)

endif(EXAMPLES)
2 changes: 1 addition & 1 deletion examples/DialExample/dial_example.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <math.h>
#include <memory>

#include <CXXGraph/CXXGraph.hpp>
#include <memory>

using std::make_shared;

Expand Down
1 change: 0 additions & 1 deletion examples/DijkstraExample/dijkstra_example.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <CXXGraph/CXXGraph.hpp>

#include <memory>

using std::make_shared;
Expand Down
17 changes: 17 additions & 0 deletions examples/FloydWarshallExample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.9)
project(floydWarshallExample)

# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES /usr/local/lib ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})

add_executable(floyd_warshall floyd_warshall.cpp)
target_include_directories(floyd_warshall PUBLIC "${CMAKE_SOURCE_DIR}/include")

target_link_libraries(floyd_warshall
pthread
ssl
crypto
z)
45 changes: 45 additions & 0 deletions examples/FloydWarshallExample/floyd_warshall.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include <CXXGraph/CXXGraph.hpp>
#include <memory>

using std::make_shared;
// example taken from
// https://www.youtube.com/watch?v=B06q2yjr-Cc
int main() {
CXXGraph::Node<int> node0("0", 0);
CXXGraph::Node<int> node1("1", 1);
CXXGraph::Node<int> node2("2", 2);
CXXGraph::Node<int> node3("3", 3);
CXXGraph::Node<int> node4("4", 4);

CXXGraph::UndirectedWeightedEdge<int> edge1(1, node0, node1, 1);
CXXGraph::UndirectedWeightedEdge<int> edge2(2, node0, node2, 2);
CXXGraph::UndirectedWeightedEdge<int> edge3(3, node1, node2, 6);
CXXGraph::UndirectedWeightedEdge<int> edge4(4, node1, node3, 4);
CXXGraph::UndirectedWeightedEdge<int> edge5(5, node2, node3, 5);
CXXGraph::UndirectedWeightedEdge<int> edge6(6, node3, node4, 3);

CXXGraph::T_EdgeSet<int> edgeSet;
edgeSet.insert(make_shared<CXXGraph::UndirectedWeightedEdge<int>>(edge1));
edgeSet.insert(make_shared<CXXGraph::UndirectedWeightedEdge<int>>(edge2));
edgeSet.insert(make_shared<CXXGraph::UndirectedWeightedEdge<int>>(edge3));
edgeSet.insert(make_shared<CXXGraph::UndirectedWeightedEdge<int>>(edge4));
edgeSet.insert(make_shared<CXXGraph::UndirectedWeightedEdge<int>>(edge5));
edgeSet.insert(make_shared<CXXGraph::UndirectedWeightedEdge<int>>(edge6));
// Can print out the edges for debugging
std::cout << edge1 << "\n";
std::cout << edge2 << "\n";
std::cout << edge3 << "\n";
std::cout << edge4 << "\n";
std::cout << edge5 << "\n";
std::cout << edge6 << "\n";

CXXGraph::Graph<int> graph(edgeSet);
CXXGraph::FWResult res = graph.floydWarshall();
std::cout << "floyd Warshall Result: "
<< "\n";
for (auto i : res.result) {
std::cout << "distance of: " << i.first.first << " " << i.first.second
<< " = " << i.second << "\n";
}
return 0;
}
28 changes: 16 additions & 12 deletions examples/NetworkDynamicsExample/network_dynamics_example.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "CXXGraph/CXXGraph.hpp"

#include <memory>

#include "CXXGraph/CXXGraph.hpp"

using std::make_shared;

int main() {
Expand All @@ -25,23 +25,26 @@ int main() {

auto degreeMatrix = graph.getDegreeMatrix();
for (const auto& nodePair : *degreeMatrix) {
const CXXGraph::shared<const CXXGraph::Node<int>>& node = nodePair.first;
const std::vector<int>& degrees = nodePair.second;
const CXXGraph::shared<const CXXGraph::Node<int>>& node = nodePair.first;
const std::vector<int>& degrees = nodePair.second;

std::cout << "Node: " << node->getId() << ", Degree: " << degrees[0] << "\n";
}
std::cout << "Node: " << node->getId() << ", Degree: " << degrees[0]
<< "\n";
}
auto laplacianMatrix = graph.getLaplacianMatrix();
for (const auto& nodePair : *laplacianMatrix) {
const auto& node = nodePair.first;
const auto& neighbors = nodePair.second;

std::cout << "Node " << node->getId() << " connected to:" << std::endl;
for (const auto& neighbor : neighbors) {
if (neighbor.first == node) {
std::cout << " -> Itself" << std::endl;
} else {
std::cout << " -> Node " << neighbor.first->getId() << " with Edge ID " << (neighbor.second ? neighbor.second->getId() : -1) << std::endl;
}
if (neighbor.first == node) {
std::cout << " -> Itself" << std::endl;
} else {
std::cout << " -> Node " << neighbor.first->getId() << " with Edge ID "
<< (neighbor.second ? neighbor.second->getId() : -1)
<< std::endl;
}
}
std::cout << std::endl;
}
Expand All @@ -53,7 +56,8 @@ int main() {

std::cout << "Transitions from Node " << node->getId() << ":" << std::endl;
for (const auto& transition : transitions) {
std::cout << " -> To Node " << transition.first->getId() << " with Probability " << transition.second << std::endl;
std::cout << " -> To Node " << transition.first->getId()
<< " with Probability " << transition.second << std::endl;
}
std::cout << std::endl;
}
Expand Down
15 changes: 9 additions & 6 deletions examples/PartitionExample/partition_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ int main() {
// std::cout << *cit_graph_ptr << std::endl;
std::cout << cit_graph_ptr->getEdgeSet().size() << std::endl;
std::cout << cit_graph_ptr->getNodeSet().size() << std::endl;
auto partitionedTwo = cit_graph_ptr->partitionGraph(
CXXGraph::Partitioning::HDRF_ALG, 2, 1, 1, 1, 4);
auto partitionedTwo =
CXXGraph::Partitioning::Partitioner<int>::partitionGraph(
*cit_graph_ptr, CXXGraph::Partitioning::HDRF_ALG, 2, 1, 1, 1, 4);
std::cout << "end partition two" << std::endl;
auto partitionedFour = cit_graph_ptr->partitionGraph(
CXXGraph::Partitioning::HDRF_ALG, 4, 1, 1, 1, 4);
auto partitionedFour =
CXXGraph::Partitioning::Partitioner<int>::partitionGraph(
*cit_graph_ptr, CXXGraph::Partitioning::HDRF_ALG, 4, 1, 1, 1, 4);
std::cout << "end partition four" << std::endl;
auto partitionedEight = cit_graph_ptr->partitionGraph(
CXXGraph::Partitioning::HDRF_ALG, 8, 1, 1, 1, 4);
auto partitionedEight =
CXXGraph::Partitioning::Partitioner<int>::partitionGraph(
*cit_graph_ptr, CXXGraph::Partitioning::HDRF_ALG, 8, 1, 1, 1, 4);
std::cout << "end partition eight" << std::endl;
auto statsTwo = CXXGraph::Partitioning::getPartitionStats(partitionedTwo);
auto statsFour = CXXGraph::Partitioning::getPartitionStats(partitionedFour);
Expand Down
17 changes: 17 additions & 0 deletions examples/PrimExample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.9)
project(PrimExample)

# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES /usr/local/lib ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})

add_executable(prim_example prim_example.cpp)
target_include_directories(prim_example PUBLIC "${CMAKE_SOURCE_DIR}/include")

target_link_libraries(prim_example
pthread
ssl
crypto
z)
Loading

0 comments on commit 823ef8f

Please sign in to comment.