Skip to content

Commit

Permalink
Merge pull request #73 from stdgraph/multipartite
Browse files Browse the repository at this point in the history
Multipartite
  • Loading branch information
pratzl committed Nov 1, 2023
2 parents 021e7b6 + 9cf7b2a commit 543828b
Show file tree
Hide file tree
Showing 4 changed files with 744 additions and 7 deletions.
8 changes: 4 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"name": "linux-common",
"hidden": true,
"generator": "Ninja",
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
Expand Down Expand Up @@ -121,8 +121,8 @@
{
"name": "macos-default",
"displayName": "macOS Debug",
"description": "Target a remote macOS system with Ninja",
"generator": "Ninja",
"description": "Target a remote macOS system with Ninja Multi-Config",
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
Expand All @@ -145,7 +145,7 @@
{
"name": "windows-common",
"hidden": true,
"generator": "Ninja",
"generator": "Ninja Multi-Config",
"architecture": {
"value": "x64",
"strategy": "external"
Expand Down
6 changes: 3 additions & 3 deletions include/graph/algorithm/pagerank.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ void pagerank(
std::vector<weight_type> iweights(size(vertices(g)));

// Initialize the data, pagerank as 1/n_vertices.
std::ranges::fill(scores, 1.0f / size(vertices(g)));
std::ranges::fill(scores, 1.0 / double(size(vertices(g))));

for (auto&& [uid, u] : views::vertexlist(g)) {
// Calculate the degree of each vertex.
size_t edge_cnt = 0;
for (auto&& uv : edges(g, u)) {
++edge_cnt;
}
degrees[uid] = edge_cnt;
degrees[uid] = static_cast<id_type>(edge_cnt);

// Find the sum of outgoing weights.
weight_type val = 0;
Expand All @@ -102,7 +102,7 @@ void pagerank(
dsum += (iweights[uid] == 0) ? damping_factor * scores[uid] : 0;
}

std::ranges::fill(scores, (1 - damping_factor + dsum) / size(vertices(g)));
std::ranges::fill(scores, (1 - damping_factor + dsum) / double(size(vertices(g))));

double error = 0;
for (auto&& [uid, vid, uv, val] : views::edgelist(g, weight_fn)) {
Expand Down
Loading

0 comments on commit 543828b

Please sign in to comment.