Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELEASE] cugraph v0.14 #914

Merged
merged 654 commits into from
Jun 3, 2020
Merged
Changes from 8 commits
Commits
Show all changes
654 commits
Select commit Hold shift + click to select a range
6765024
ki_truss
BradReesWork May 12, 2020
2e65ff7
updates to run doxygen
BradReesWork May 12, 2020
52ea239
Merge remote-tracking branch 'upstream/branch-0.14' into branch-0.14-…
rlratzel May 12, 2020
3de08b7
changelog
BradReesWork May 12, 2020
96eeb67
Merge pull request #862 from kaatish/fea-katz-raii
BradReesWork May 12, 2020
4675296
Updated to use new marks, enabled more benchmarks, doing additional E…
rlratzel May 12, 2020
d00e543
Removed utility not needed since they're natively supported by cugrap…
rlratzel May 12, 2020
ec5623c
Merge remote-tracking branch 'upstream/branch-0.14' into branch-0.14-…
rlratzel May 12, 2020
f91a09f
added texted on running doc generator
BradReesWork May 12, 2020
93934e1
extra text on manual running
BradReesWork May 12, 2020
e538d3d
Merge branch 'branch-0.14' into branch-0.14
BradReesWork May 12, 2020
f6242e7
Merge pull request #865 from BradReesWork/branch-0.14
BradReesWork May 12, 2020
b801ec0
first working version of louvain
ChuckHastings May 13, 2020
84e656d
graph: replace multigraph value by false
xcadet May 13, 2020
c56a776
Merge branch 'branch-0.14' of github.com:rapidsai/cugraph into fea-kt…
kaatish May 13, 2020
068b158
Merge remote-tracking branch 'upstream/branch-0.14' into branch-0.14-…
rlratzel May 13, 2020
1c4c6e8
Fixed KTruss to work with new graph class
kaatish May 13, 2020
ce9d3c7
Moved ktruss to community in cpp
kaatish May 13, 2020
bebca10
Moved ktruss to community in python
kaatish May 13, 2020
65431fc
CHANGELOG fix
kaatish May 13, 2020
5c9255b
Undo accidental change to run-clang-format.py
kaatish May 13, 2020
8dc5250
clang-format fixes
kaatish May 13, 2020
a048b05
Merge branch 'fea-ktruss-raii' of github.com:kaatish/cugraph into fea…
kaatish May 13, 2020
67384c5
More Louvain work:
ChuckHastings May 13, 2020
698f28a
Documentation fix
kaatish May 13, 2020
c829085
Updates to support the latest flake8 version.
rlratzel May 13, 2020
848e616
Added PR 867 to CHANGELOG.md
rlratzel May 13, 2020
568d292
with louvain moved from nvgraph, remove a bunch of obsolete headers
ChuckHastings May 13, 2020
6f1e723
update changelog
ChuckHastings May 13, 2020
3367ead
bfs: removed extra sizeof multiplication
xcadet May 13, 2020
bce3500
bfs: reorder and allocations
xcadet May 14, 2020
aaaba66
Merge pull request #867 from rlratzel/branch-0.14-fixchecks
BradReesWork May 14, 2020
66fa0cf
Merge remote-tracking branch 'upstream/branch-0.14' into branch-0.14-…
rlratzel May 14, 2020
cd37420
Fixed ktruss_subgraph init
kaatish May 14, 2020
07f4638
Merge branch 'branch-0.14' of github.com:rapidsai/cugraph into fea-kt…
kaatish May 14, 2020
315ef9d
Revert "bfs: updated with rmm device_vector and add CUDA error checking"
xcadet May 14, 2020
47cb378
Merge pull request #866 from kaatish/fea-ktruss-raii
BradReesWork May 14, 2020
be087b2
update setup.py for custom clean
Iroy30 May 14, 2020
d1df324
add changelog
Iroy30 May 14, 2020
328353e
flake8
Iroy30 May 14, 2020
3e50050
review updates
Iroy30 May 15, 2020
f040666
Merge pull request #874 from Iroy30/update_setup.py
BradReesWork May 15, 2020
0a7a2c1
Add interface for force atlas 2
hlinsen Mar 11, 2020
d449f32
Add fa2l dependency to run pytests
hlinsen Mar 11, 2020
4461c56
Use new graph structuring and add initialization list for vertex
hlinsen Mar 11, 2020
6580228
Add python test
hlinsen Mar 12, 2020
3dacf41
Update interface and fix compile errors
hlinsen Mar 12, 2020
3e5e076
Add cuda template
hlinsen Mar 13, 2020
ea41b05
Update fa2 dependency
hlinsen Mar 13, 2020
cb8a5ec
Test passing
hlinsen Mar 13, 2020
399eda5
Check positions are the same for networkx and cugraph
hlinsen Mar 13, 2020
6dcd335
Normalize interface and remove vertex column when returning df
hlinsen Mar 13, 2020
e39ce57
Update doc
hlinsen Mar 13, 2020
8ced917
Remove modified file from pull request
hlinsen Mar 13, 2020
eeee84f
Simple render with Datashader
hlinsen Mar 17, 2020
fc929b6
Add option to run exact force atlas and add vertex
hlinsen Mar 20, 2020
2267525
Create templated functions and kernels
hlinsen Mar 21, 2020
dc4f2f0
Switch to CSR format
hlinsen Mar 23, 2020
e0b96ca
Implement kernels with CSR
hlinsen Mar 24, 2020
7837396
Handle division by zero
hlinsen Mar 31, 2020
53c0ec1
Fix gravity kernel loop
hlinsen Mar 31, 2020
dc7bda2
Compute best jitter tolerance and speed on CPU
hlinsen Mar 31, 2020
3227d0f
Add outbound attraction compensation
hlinsen Apr 1, 2020
75cd991
Switch back to COO
hlinsen Apr 2, 2020
79318e9
Sort and compute degree with COO
hlinsen Apr 3, 2020
78e234e
Fix attraction kernel
hlinsen Apr 3, 2020
ad1533a
Obtain same global speed as networkx
hlinsen Apr 3, 2020
d1f20f6
Working with few iterations
hlinsen Apr 3, 2020
5b6ff36
Fix global speed adaptation
hlinsen Apr 3, 2020
8a10825
Refactor sort and mass initialization
hlinsen Apr 3, 2020
ac1ede8
Refactor headers
hlinsen Apr 3, 2020
2ff8cc8
Update test
hlinsen Apr 4, 2020
32dcc96
Add weight option as template
hlinsen Apr 6, 2020
a3402fa
Add random vector generation
hlinsen Apr 6, 2020
f5c036a
Remove unused headers
hlinsen Apr 6, 2020
b593f30
Add barnes hut
hlinsen Apr 7, 2020
71894c1
Update repulsion kernel
hlinsen Apr 7, 2020
ae66441
Add force update for barnes hut
hlinsen Apr 8, 2020
d769028
Update barnes hut mass initialization
hlinsen Apr 8, 2020
945c1db
Fix kernel launch
hlinsen Apr 8, 2020
4fc74cd
Refactor kernels
hlinsen Apr 8, 2020
1709050
Add restrict to pointers
hlinsen Apr 8, 2020
87a6186
Add check for unsupported options
hlinsen Apr 8, 2020
bf2589c
Update documentation
hlinsen Apr 9, 2020
2ff3021
Add lin log mode
hlinsen Apr 9, 2020
a16b79e
Add internal callback wrappers and implementation
hlinsen Apr 9, 2020
6db64e1
Update doc
hlinsen Apr 10, 2020
18b51cb
Remove duplicate function call
hlinsen Apr 10, 2020
aba20c4
Test trustworthiness instead of positions
hlinsen Apr 10, 2020
18d2a7d
Fix wrapper, bug with the number of edges in COO
hlinsen Apr 11, 2020
f22eea3
Fix swinging and traction memset
hlinsen Apr 13, 2020
ad71a97
Fix exact repulsion
hlinsen Apr 13, 2020
2a9d411
Fix barnes hut nodes creation
hlinsen Apr 14, 2020
a23e1e3
Remove timer
hlinsen Apr 14, 2020
7789607
Fix number of edges
hlinsen Apr 16, 2020
2165d60
Update notebook
hlinsen Apr 17, 2020
274c599
Add unrenumbering in wrapper
hlinsen Apr 17, 2020
94b52a0
Add cpp tests
hlinsen Apr 20, 2020
9c670f5
Clean and fix lin log
hlinsen Apr 29, 2020
18e1523
Update bottom bound for out of cell memory case
hlinsen May 1, 2020
84736a6
Clean up barnes hut and notebook
hlinsen May 1, 2020
fa22546
Implement trustworthiness score
hlinsen May 6, 2020
a79fe86
Integrate 0.14 changes
hlinsen May 6, 2020
c83a70f
Run clang format
hlinsen May 7, 2020
24e7435
Handle directed case
hlinsen May 7, 2020
1cba1bd
Update to graph view
hlinsen May 7, 2020
72aed43
Update changelog
hlinsen May 7, 2020
29ff20a
Update cpp doc
hlinsen May 7, 2020
31ab545
Update copyright
hlinsen May 7, 2020
7a1c2d6
Update copyright
hlinsen May 7, 2020
857a672
Update doc and pytest
hlinsen May 8, 2020
82650c9
Add vertex ids to position list
hlinsen May 8, 2020
baec892
Add fa2 to README and doc
hlinsen May 9, 2020
35e45ca
Add more comments in cpp code
hlinsen May 11, 2020
e1f095e
Remove matrix reader
hlinsen May 11, 2020
4ff7bf3
Fix flake8 errors
hlinsen May 11, 2020
4d5fcd8
Fix more flake8 error
hlinsen May 11, 2020
e606bea
Fix typo in docs
hlinsen May 13, 2020
1fc5e02
Compute distance inside lin log block
hlinsen May 13, 2020
93d15f1
Fix random seed value
hlinsen May 13, 2020
04780db
Update threshold values
hlinsen May 13, 2020
f3460c0
Add check for 0 edge and empty graph
hlinsen May 14, 2020
e0e492b
Rename headers and add rmm exec policy
hlinsen May 14, 2020
fc69231
Revert notebook
hlinsen May 15, 2020
909430b
bc: corrected typo in python doc
xcadet May 15, 2020
3abcba8
Merge pull request #817 from xcadet/fea_bc
BradReesWork May 15, 2020
f7e84f3
UVM notebook
afender May 15, 2020
fa3805b
skip CI for uvm notebook
afender May 15, 2020
ed91c57
Update CHANGELOG.md
afender May 15, 2020
1f64548
bfs: start migrating tests from bc to bfs
xcadet May 15, 2020
5162d58
contributing: corrected typos
xcadet May 15, 2020
938f247
Update uvm.ipynb
afender May 15, 2020
263c17b
Update uvm.ipynb
afender May 15, 2020
ac7e73f
bfs: moved ref bfs to own file, add pred check
xcadet May 15, 2020
5b4fd41
Merge pull request #756 from hlinsen/force-atlas2
BradReesWork May 15, 2020
2ad3465
bfs: add tests bfs_ref, rename generate_graph_csr_from_mtx to generat…
xcadet May 15, 2020
81ed966
bfs: renamed n and nnz, initialized to ptrd to nullptr
xcadet May 15, 2020
d7d4222
updated build for docs
BradReesWork May 17, 2020
8f620f2
chnagelog
BradReesWork May 17, 2020
9b27741
Merge pull request #878 from BradReesWork/branch-0.14-build
BradReesWork May 18, 2020
2c663c1
addressed reviews
afender May 18, 2020
f8af80a
added a couple of emphasis
afender May 18, 2020
5c3662b
Add docs build.sh
dillon-cullinan May 18, 2020
be1e01f
Changelog
dillon-cullinan May 18, 2020
53740b9
Updates to address review feedback: added RMM reinit code, markers, a…
rlratzel May 18, 2020
9b346a0
Merge remote-tracking branch 'upstream/branch-0.14' into branch-0.14-…
rlratzel May 18, 2020
88cd3b2
Merge pull request #879 from dillon-cullinan/gpuci-docs
BradReesWork May 18, 2020
98f32cf
Merge remote-tracking branch 'upstream/branch-0.14' into branch-0.14-…
rlratzel May 18, 2020
f42faf8
Merge pull request #875 from afender/uvm_notebook
BradReesWork May 18, 2020
9be1f8d
Merge pull request #818 from rlratzel/branch-0.14-pytest-benchmark
BradReesWork May 18, 2020
6fc69d9
clean up final gdf_column references, a few more allocations, delete …
ChuckHastings May 18, 2020
a3b6235
merge with latest branch
ChuckHastings May 18, 2020
b129e76
update changelog
ChuckHastings May 18, 2020
9c9ad0a
fix flake8 issue
ChuckHastings May 18, 2020
be5507f
clean up sorting code
ChuckHastings May 18, 2020
a5f1664
missed grmat_wrapper
ChuckHastings May 18, 2020
381981f
fix formatting
ChuckHastings May 18, 2020
27c3171
missed removing test
ChuckHastings May 19, 2020
4cffcf4
bfs: python test use cupy for comparison
xcadet May 19, 2020
9f18481
merge branch 0.14 into enh_bfs_cpp_tests for bench
xcadet May 19, 2020
094e6bf
bc: add to benchmark
xcadet May 19, 2020
ea88aa3
Raft integration infra
Iroy30 May 19, 2020
4fa9b09
setup.py update
Iroy30 May 19, 2020
019a7ad
remove sort test
ChuckHastings May 19, 2020
d9b8721
bfs: update changelog and fix flake8
xcadet May 19, 2020
dc812b4
add changelog
Iroy30 May 19, 2020
023e338
flake8
Iroy30 May 19, 2020
67461ae
Merge branch 'branch-0.14' into raft_integration_infra
afender May 19, 2020
7cae71a
utf-8 encoding
Iroy30 May 20, 2020
ad6e121
remove grmat (not implemented in current version
ChuckHastings May 20, 2020
886928b
Merge pull request #881 from Iroy30/raft_integration_infra
BradReesWork May 20, 2020
a73b954
Merge pull request #876 from xcadet/enh_bfs_cpp_tests
afender May 20, 2020
8e8c906
Update python doc
hlinsen May 18, 2020
8964c92
Add force atlas to benchmarks
hlinsen May 19, 2020
3393f9d
Update changelog
hlinsen May 19, 2020
e44dac0
Update test threshold too high
hlinsen May 20, 2020
7f08e42
Merge pull request #882 from hlinsen/fa2-benchmarks
BradReesWork May 20, 2020
7106481
add back support for int64 -> int32 renumbering
ChuckHastings May 20, 2020
6d3f9fd
remove some debug prints I left in last commit
ChuckHastings May 20, 2020
567bb41
Update CHANGELOG.md
BradReesWork May 20, 2020
8d04b21
Merge branch 'branch-0.14' into bug_gdf_column_dogs_and_cats
ChuckHastings May 20, 2020
58ca41e
Merge branch 'branch-0.14' into bug_gdf_column_dogs_and_cats
ChuckHastings May 20, 2020
9330bf2
update formatting issues
ChuckHastings May 20, 2020
68b6250
Added conftest.py file missing from last commit which adds the --no-r…
rlratzel May 20, 2020
cae7525
Merge remote-tracking branch 'upstream/branch-0.14' into branch-0.14-…
rlratzel May 20, 2020
809a156
Updated CHANGELOG.md with PR 889
rlratzel May 20, 2020
3f21e5d
remove libcudf dependency in cmake, remove old Graph.cu test
ChuckHastings May 20, 2020
dfb7bce
Merge pull request #880 from ChuckHastings/bug_gdf_column_dogs_and_cats
afender May 21, 2020
c22bbeb
A few straggler things to clean up
ChuckHastings May 21, 2020
fef95f6
update changelog
ChuckHastings May 21, 2020
760d132
Merge pull request #889 from rlratzel/branch-0.14-pytest-benchmark
BradReesWork May 21, 2020
8300ca0
add external repositories and raft symlinks to .gitignore
trxcllnt May 21, 2020
50b33d8
changelog
trxcllnt May 21, 2020
6440ca9
Merge pull request #891 from ChuckHastings/bug_missed_some_gdf_column…
BradReesWork May 21, 2020
5e9fd53
Merge branch 'branch-0.14' into git-ignore-external-repositories
BradReesWork May 21, 2020
fd9b046
Merge pull request #893 from trxcllnt/git-ignore-external-repositories
BradReesWork May 21, 2020
2db902d
dask infra updates
Iroy30 May 21, 2020
131da4e
Remove some RMM_ALLOC calls
kaatish May 22, 2020
6d49cab
Merge branch 'branch-0.14' of github.com:rapidsai/cugraph into fix_tw…
kaatish May 22, 2020
5151e91
Removed RMM_ALLOC, RMM_FREE
kaatish May 22, 2020
e52e493
CHANGELOG fix
kaatish May 22, 2020
a0699aa
Clang fixes
kaatish May 22, 2020
51bba23
add ucx-py
Iroy30 May 22, 2020
2cced76
add ucx-py
Iroy30 May 22, 2020
1a59cc8
add ucx-py
Iroy30 May 22, 2020
7ecdf22
Removed references to deleted cudf files
kaatish May 22, 2020
783f36e
PR comment fixes
kaatish May 22, 2020
b564f0e
Removed rmm_utils.h
kaatish May 22, 2020
0900ce1
Clang format fixes
kaatish May 22, 2020
f8a92a7
update include paths for removed cudf headers
trxcllnt May 22, 2020
a292845
changelog
trxcllnt May 22, 2020
be5c53f
Removed rmmInitialize from tests
kaatish May 22, 2020
0963437
Clang style fix and Cuda allocation in tests
kaatish May 23, 2020
0842270
Merge pull request #899 from trxcllnt/remove-experimental-namespace
afender May 23, 2020
e708bbe
Merge branch 'branch-0.14' of github.com:rapidsai/cugraph into fix_tw…
kaatish May 26, 2020
d5fbbf8
Merge pull request #897 from kaatish/fix_two_hop_raii
afender May 26, 2020
3db3622
Louvain optimization
ChuckHastings May 27, 2020
61e8ed6
fix clang format
ChuckHastings May 27, 2020
301684b
Merge branch 'branch-0.14' into fix_louvain
ChuckHastings May 27, 2020
568aa6a
fix flake8 check
ChuckHastings May 27, 2020
7d41b10
deleted unused file
ChuckHastings May 27, 2020
87975fd
move ECG out of nvgraph namespace
ChuckHastings May 27, 2020
a2d22e3
Merge pull request #896 from Iroy30/dask_infra_updates
BradReesWork May 27, 2020
5e024a4
Merge pull request #870 from ChuckHastings/fix_louvain
afender May 27, 2020
f935487
update Louvain notebook to include some documentation about parallel …
ChuckHastings May 27, 2020
fff3dfd
bfS: fix directed missing vertex
xcadet May 27, 2020
db66c86
update changelog
ChuckHastings May 27, 2020
59ece1d
update changelog
xcadet May 27, 2020
5dfed99
Merge pull request #906 from ChuckHastings/update_louvain_notebook
BradReesWork May 27, 2020
04133b9
Merge pull request #907 from xcadet/fix_directed_bfs
BradReesWork May 27, 2020
6ce0f26
get sphinx_markdown_tables from conda
afender May 27, 2020
d1011f5
changelog fix
afender May 27, 2020
f70028a
Merge pull request #911 from afender/env_014
BradReesWork May 28, 2020
ec65777
Reset trustworthiness thresholds
hlinsen May 28, 2020
c9d8481
Update changelog
hlinsen May 28, 2020
d1a75a7
bc: drop gunrock path and cmake rules
xcadet May 28, 2020
031ace8
update changelog
xcadet May 28, 2020
6dffd31
cpp: keep gunrcok dependencies
xcadet May 28, 2020
d13f448
Merge pull request #916 from hlinsen/fa2-fix
BradReesWork May 29, 2020
d5397a5
Merge pull request #917 from xcadet/enh_bc_drop_gunrock
BradReesWork May 29, 2020
ce61111
Updated pagerank with @afender 's temp fix for crash when tmp vector …
rlratzel Jun 1, 2020
7c01960
Added PR 923 to CHANGELOG.md
rlratzel Jun 1, 2020
ad8e6f4
Merge pull request #923 from rlratzel/0.14-pagerank_fix
BradReesWork Jun 2, 2020
9fac1b5
Update CHANGELOG.md
raydouglass Jun 2, 2020
6a82825
Update scikit learn dependency
hlinsen Jun 2, 2020
b764e8c
Update changelog
hlinsen Jun 2, 2020
da0a9f8
Merge pull request #927 from hlinsen/fa2-ci
raydouglass Jun 2, 2020
0b0263f
Update scikit version to support libgcc-ng 7.3
dillon-cullinan Jun 3, 2020
68c5b62
Changelog
dillon-cullinan Jun 3, 2020
8f077b8
Merge pull request #928 from dillon-cullinan/fix-scikitver
raydouglass Jun 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
- PR #834 Updated local gpuci build
- PR #845 Add .clang-format & format all files
- PR #859 Updated main docs
- PR #862 Katz Centrality : Auto calculation of alpha parameter if set to none
- PR #818 Initial version of new "benchmarks" folder

## Bug Fixes
2 changes: 1 addition & 1 deletion cpp/include/graph.hpp
Original file line number Diff line number Diff line change
@@ -54,8 +54,8 @@ enum class DegreeDirection {
template <typename VT, typename ET, typename WT>
class GraphViewBase {
public:
Comm comm;
WT *edge_data; ///< edge weight
Comm comm;

GraphProperties prop;

7 changes: 3 additions & 4 deletions cpp/src/centrality/katz_centrality.cu
Original file line number Diff line number Diff line change
@@ -42,14 +42,13 @@ void katz_centrality(experimental::GraphCSRView<VT, ET, WT> const &graph,
using HornetInit = hornet::HornetInit<VT>;
using Katz = hornets_nest::KatzCentralityStatic;

// Ask hornet to calculate alpha
if (alpha == 0) { alpha = std::numeric_limits<double>::max(); }

HornetInit init(graph.number_of_vertices, graph.number_of_edges, graph.offsets, graph.indices);
HornetGraph hnt(init, hornet::DeviceType::DEVICE);
Katz katz(hnt, alpha, max_iter, tol, normalized, isStatic, result);
if (katz.getAlpha() < alpha) {
CUGRAPH_FAIL("Error : alpha is not small enough for convergence");
}
katz.run();
if (!katz.hasConverged()) { CUGRAPH_FAIL("Error : Convergence not reached"); }
}

template void katz_centrality<int, int, float, double>(
16 changes: 12 additions & 4 deletions python/cugraph/centrality/katz_centrality.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@


def katz_centrality(G,
alpha=0.1,
alpha=None,
max_iter=100,
tol=1.0e-6,
nstart=None,
@@ -37,9 +37,17 @@ def katz_centrality(G,
cuGraph graph descriptor with connectivity information. The graph can
contain either directed (DiGraph) or undirected edges (Graph).
alpha : float
Attenuation factor with a default value of 0.1. If alpha is not less
than 1/(lambda_max) where lambda_max is the maximum degree
GDF_CUDA_ERROR is returned
Attenuation factor defaulted to None. If alpha is not specified then
it is internally calculated as 1/(degree_max) where degree_max is the
maximum out degree.
NOTE : The maximum acceptable value of alpha for convergence
alpha_max = 1/(lambda_max) where lambda_max is the largest eigenvalue
of the graph.
Since lambda_max is always lesser than or equal to degree_max for a
graph, alpha_max will always be greater than or equal to
(1/degree_max). Therefore, setting alpha to (1/degree_max) will
guarantee that it will never exceed alpha_max thus in turn fulfilling
the requirement for convergence.
max_iter : int
The maximum number of iterations before an answer is returned. This can
be used to limit the execution time and do an early exit before the
37 changes: 17 additions & 20 deletions python/cugraph/centrality/katz_centrality_wrapper.pyx
Original file line number Diff line number Diff line change
@@ -29,32 +29,19 @@ import rmm
import numpy as np


def katz_centrality(input_graph, alpha=0.1, max_iter=100, tol=1.0e-5, nstart=None, normalized=True):
"""
Call katz_centrality
"""
if not input_graph.adjlist:
input_graph.view_adj_list()

[offsets, indices] = graph_wrapper.datatype_cast([input_graph.adjlist.offsets, input_graph.adjlist.indices], [np.int32])

def get_output_df(input_graph, nstart):
num_verts = input_graph.number_of_vertices()
num_edges = len(indices)

df = cudf.DataFrame()
df['vertex'] = cudf.Series(np.zeros(num_verts, dtype=np.int32))

has_guess = False

if nstart is None:
df['katz_centrality'] = cudf.Series(np.zeros(num_verts, dtype=np.float64))
else:
has_guess = True
if len(nstart) != num_verts:
raise ValueError('nstart must have initial guess for all vertices')

nstart = graph_wrapper.datatype_cast([nstart], [np.float64])

if input_graph.renumbered is True:
renumber_series = cudf.Series(input_graph.edgelist.renumber_map.index,
index=input_graph.edgelist.renumber_map)
@@ -66,14 +53,24 @@ def katz_centrality(input_graph, alpha=0.1, max_iter=100, tol=1.0e-5, nstart=Non
df['katz_centrality'] = cudf.Series(cudf._lib.copying.scatter(nstart['values']._column,
nstart['vertex']._column,
df['katz_centrality']._column))
return df


def katz_centrality(input_graph, alpha=None, max_iter=100, tol=1.0e-5, nstart=None, normalized=True):
"""
Call katz_centrality
"""

df = get_output_df(input_graph, nstart)
if nstart is not None:
has_guess = True
if alpha is None:
alpha = 0

cdef uintptr_t c_identifier = df['vertex'].__cuda_array_interface__['data'][0]
cdef uintptr_t c_katz = df['katz_centrality'].__cuda_array_interface__['data'][0]
cdef uintptr_t c_offsets = offsets.__cuda_array_interface__['data'][0]
cdef uintptr_t c_indices = indices.__cuda_array_interface__['data'][0]

cdef GraphCSRView[int,int,float] graph
graph = GraphCSRView[int,int,float](<int*>c_offsets, <int*>c_indices, <float*>NULL, num_verts, num_edges)

cdef GraphCSRViewFloat graph = get_graph_view[GraphCSRViewFloat](input_graph, True)

c_katz_centrality[int,int,float,double](graph, <double*> c_katz, alpha, max_iter, tol, has_guess, normalized)

22 changes: 17 additions & 5 deletions python/cugraph/structure/graph_new.pxd
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ cdef extern from "graph.hpp" namespace "cugraph::experimental":

void get_source_indices(VT *) const
void degree(ET *,DegreeDirection) const

GraphCompressedSparseBaseView(const VT *, const ET *, const WT *, size_t, size_t)

cdef cppclass GraphCSRView[VT,ET,WT](GraphCompressedSparseBaseView[VT,ET,WT]):
@@ -136,27 +136,39 @@ cdef extern from "<utility>" namespace "std" nogil:
cdef GraphSparseContents[int,int,float] move(GraphSparseContents[int,int,float])
cdef GraphSparseContents[int,int,double] move(GraphSparseContents[int,int,double])

ctypedef unique_ptr[GraphCOO[int,int,float]] GraphCOOPtrFloat
ctypedef unique_ptr[GraphCOO[int,int,float]] GraphCOOPtrFloat
ctypedef unique_ptr[GraphCOO[int,int,double]] GraphCOOPtrDouble

ctypedef fused GraphCOOPtrType:
GraphCOOPtrFloat
GraphCOOPtrDouble

ctypedef unique_ptr[GraphCSR[int,int,float]] GraphCSRPtrFloat
ctypedef unique_ptr[GraphCSR[int,int,float]] GraphCSRPtrFloat
ctypedef unique_ptr[GraphCSR[int,int,double]] GraphCSRPtrDouble

ctypedef fused GraphCSRPtrType:
GraphCSRPtrFloat
GraphCSRPtrDouble

ctypedef GraphCOOView[int,int,float] GraphCOOViewFloat
ctypedef GraphCOOView[int,int,float] GraphCOOViewFloat
ctypedef GraphCOOView[int,int,double] GraphCOOViewDouble
ctypedef GraphCSRView[int,int,float] GraphCSRViewFloat
ctypedef GraphCSRView[int,int,double] GraphCSRViewDouble

ctypedef fused GraphCOOViewType:
GraphCOOViewFloat
GraphCOOViewDouble

ctypedef fused GraphCSRViewType:
GraphCSRViewFloat
GraphCSRViewDouble

ctypedef fused GraphViewType:
GraphCOOViewFloat
GraphCOOViewDouble
GraphCSRViewFloat
GraphCSRViewDouble

cdef coo_to_df(GraphCOOPtrType graph)
cdef csr_to_series(GraphCSRPtrType graph)
cdef GraphCOOViewType get_graph_view(input_graph, GraphCOOViewType* dummy=*)
cdef GraphViewType get_graph_view(input_graph, bool weightless=*, GraphViewType* dummy=*)
38 changes: 34 additions & 4 deletions python/cugraph/structure/graph_new.pyx
Original file line number Diff line number Diff line change
@@ -68,17 +68,36 @@ cdef csr_to_series(GraphCSRPtrType graph):
return (csr_offsets, csr_indices, csr_weights)


cdef GraphCOOViewType get_graph_view(input_graph, GraphCOOViewType* dummy=NULL):
cdef GraphCSRViewType get_csr_graph_view(input_graph, bool weightless=False, GraphCSRViewType* dummy=NULL):
if not input_graph.adjlist:
input_graph.view_adj_list()

cdef uintptr_t c_off = input_graph.adjlist.offsets.__cuda_array_interface__['data'][0]
cdef uintptr_t c_ind = input_graph.adjlist.indices.__cuda_array_interface__['data'][0]
cdef uintptr_t c_weights = <uintptr_t>NULL

if input_graph.adjlist.weights and not weightless:
c_weights = input_graph.adjlist.weights.__cuda_array_interface__['data'][0]

num_verts = input_graph.number_of_vertices()
num_edges = len(input_graph.adjlist.indices)
cdef GraphCSRViewType in_graph
if GraphCSRViewType is GraphCSRViewFloat:
in_graph = GraphCSRViewFloat(<int*>c_off, <int*>c_ind, <float*>c_weights, num_verts, num_edges)
elif GraphCSRViewType is GraphCSRViewDouble:
in_graph = GraphCSRViewDouble(<int*>c_off, <int*>c_ind, <double*>c_weights, num_verts, num_edges)
return in_graph


cdef GraphCOOViewType get_coo_graph_view(input_graph, bool weightless=False, GraphCOOViewType* dummy=NULL):
if not input_graph.edgelist:
input_graph.view_edge_list()

weights = None

cdef uintptr_t c_src = input_graph.edgelist.edgelist_df['src'].__cuda_array_interface__['data'][0]
cdef uintptr_t c_dst = input_graph.edgelist.edgelist_df['dst'].__cuda_array_interface__['data'][0]
cdef uintptr_t c_weights = <uintptr_t>NULL

if input_graph.edgelist.weights:
if input_graph.edgelist.weights and not weightless:
c_weights = input_graph.edgelist.edgelist_df['weights'].__cuda_array_interface__['data'][0]

num_verts = input_graph.number_of_vertices()
@@ -89,3 +108,14 @@ cdef GraphCOOViewType get_graph_view(input_graph, GraphCOOViewType* dummy=NULL):
elif GraphCOOViewType is GraphCOOViewDouble:
in_graph = GraphCOOViewDouble(<int*>c_src, <int*>c_dst, <double*>c_weights, num_verts, num_edges)
return in_graph


cdef GraphViewType get_graph_view(input_graph, bool weightless = False, GraphViewType* dummy=NULL):
if GraphViewType is GraphCOOViewFloat:
return get_coo_graph_view[GraphCOOViewFloat](input_graph, weightless, dummy)
elif GraphViewType is GraphCOOViewDouble:
return get_coo_graph_view[GraphCOOViewDouble](input_graph, weightless, dummy)
elif GraphViewType is GraphCSRViewFloat:
return get_csr_graph_view[GraphCSRViewFloat](input_graph, weightless, dummy)
elif GraphViewType is GraphCSRViewDouble:
return get_csr_graph_view[GraphCSRViewDouble](input_graph, weightless, dummy)
2 changes: 1 addition & 1 deletion python/cugraph/tests/test_katz_centrality.py
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ def calc_katz(graph_file):
largest_out_degree = largest_out_degree['out_degree'].iloc[0]
katz_alpha = 1/(largest_out_degree + 1)

k_df = cugraph.katz_centrality(G, katz_alpha, max_iter=1000)
k_df = cugraph.katz_centrality(G, None, max_iter=1000)

NM = utils.read_csv_for_nx(graph_file)
Gnx = nx.from_pandas_edgelist(NM, create_using=nx.DiGraph(),