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

update docstring and examples #1866

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def katz_centrality(input_graph,
>>> import cugraph.dask as dcg
>>> ... Init a DASK Cluster
>> see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> chunksize = dcg.get_chunksize(input_data_path)
>>> ddf = dask_cudf.read_csv(input_data_path, chunksize=chunksize,
delimiter=' ',
Expand Down
1 change: 1 addition & 0 deletions python/cugraph/cugraph/dask/community/louvain.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def louvain(input_graph, max_iter=100, resolution=1.0):
>>> import cugraph.dask as dcg
>>> ... Init a DASK Cluster
>> see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> chunksize = dcg.get_chunksize(input_data_path)
>>> ddf = dask_cudf.read_csv('datasets/karate.csv', chunksize=chunksize,
delimiter=' ',
Expand Down
1 change: 1 addition & 0 deletions python/cugraph/cugraph/dask/link_analysis/pagerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def pagerank(input_graph,
>>> import cugraph.dask as dcg
>>> ... Init a DASK Cluster
>> see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> chunksize = dcg.get_chunksize(input_data_path)
>>> ddf = dask_cudf.read_csv(input_data_path, chunksize=chunksize,
delimiter=' ',
Expand Down
1 change: 1 addition & 0 deletions python/cugraph/cugraph/dask/traversal/bfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def bfs(graph,
>>> import cugraph.dask as dcg
>>> ... Init a DASK Cluster
>> see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> chunksize = dcg.get_chunksize(input_data_path)
>>> ddf = dask_cudf.read_csv(input_data_path, chunksize=chunksize,
delimiter=' ',
Expand Down
1 change: 1 addition & 0 deletions python/cugraph/cugraph/linear_assignment/lap.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def hungarian(G, workers, epsilon=None):

Examples
--------
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> M = cudf.read_csv('datasets/bipartite.csv', delimiter=' ',
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> G = cugraph.Graph()
Expand Down
2 changes: 1 addition & 1 deletion python/cugraph/cugraph/link_prediction/jaccard.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def jaccard(input_graph, vertex_pair=None):
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> G = cugraph.Graph()
>>> G.from_cudf_edgelist(gdf, source='0', destination='1')
>>> pairs = cugraph.get_two_hop_neighbors(G)
>>> pairs = G.get_two_hop_neighbors()
>>> df = cugraph.jaccard(G, pairs)

But please remember that cugraph will fill the dataframe with the entire
Expand Down
9 changes: 8 additions & 1 deletion python/cugraph/cugraph/link_prediction/woverlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ def overlap_w(input_graph, weights, vertex_pair=None):
as an edge list (edge weights are not used for this algorithm). The
adjacency list will be computed if not already present.

weights : cudf.Series
weights : cudf.DataFrame
Specifies the weights to be used for each vertex.
Vertex should be represented by multiple columns for multi-column
vertices.

weights['vertex'] : cudf.Series
Contains the vertex identifiers
weights['weight'] : cudf.Series
Contains the weights of vertices

vertex_pair : cudf.DataFrame
A GPU dataframe consisting of two columns representing pairs of
Expand Down
7 changes: 5 additions & 2 deletions python/cugraph/cugraph/structure/convert_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,14 @@ def from_pandas_edgelist(df,

Examples
--------
>> Download dataset from
>> https://github.com/rapidsai/cugraph/datasets/...
>>> df = pandas.read_csv('datasets/karate.csv', delimiter=' ',
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> header=None, names=["0", "1", "2"],
>>> dtype={"0": "int32", "1": "int32", "2": "float32"})
>>> G = cugraph.Graph()
>>> G.from_pandas_edgelist(df, source='0', destination='1',
edge_attr='2', renumber=False)
edge_attr='2', renumber=False)
"""
if create_using is Graph:
G = Graph()
Expand Down
5 changes: 4 additions & 1 deletion python/cugraph/cugraph/structure/graph_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@ def from_pandas_edgelist(

Examples
--------
>> Download dataset from
>> https://github.com/rapidsai/cugraph/datasets/...
>>> df = pandas.read_csv('datasets/karate.csv', delimiter=' ',
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> header=None, names=["0", "1", "2"],
>>> dtype={"0": "int32", "1": "int32", "2": "float32"})
>>> G = cugraph.Graph()
>>> G.from_pandas_edgelist(df, source='0', destination='1',
edge_attr='2', renumber=False)
Expand Down
32 changes: 19 additions & 13 deletions python/cugraph/cugraph/structure/symmetrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,11 @@ def symmetrize_df(df, src_name, dst_name, multi=False, symmetrize=True):

Examples
--------
>>> import cugraph.dask as dcg
>>> Comms.initialize()
>>> chunksize = dcg.get_chunksize(input_data_path)
>>> ddf = dask_cudf.read_csv(input_data_path, chunksize=chunksize,
delimiter=' ',
names=['src', 'dst', 'weight'],
dtype=['int32', 'int32', 'float32'])
>>> sym_ddf = cugraph.symmetrize_ddf(ddf, "src", "dst", "weight")
>>> Comms.destroy()
>>> from cugraph.structure.symmetrize import symmetrize_df
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> M = cudf.read_csv('datasets/karate.csv', delimiter=' ',
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> sym_df = symmetrize(M, '0', '1')
"""
#
# Now append the columns. We add sources to the end of destinations,
Expand Down Expand Up @@ -127,9 +123,17 @@ def symmetrize_ddf(df, src_name, dst_name, weight_name=None):

Examples
--------
>>> M = cudf.read_csv('datasets/karate.csv', delimiter=' ',
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> sym_df = cugraph.symmetrize(M, '0', '1')
>>> import cugraph.dask as dcg
>>> from cugraph.structure.symmetrize import symmetrize_ddf
>>> ... Init a DASK Cluster
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> chunksize = dcg.get_chunksize(input_data_path)
>>> ddf = dask_cudf.read_csv(input_data_path, chunksize=chunksize,
delimiter=' ',
names=['src', 'dst', 'weight'],
dtype=['int32', 'int32', 'float32'])
>>> sym_ddf = symmetrize_ddf(ddf, "src", "dst", "weight")
>>> Comms.destroy()
"""
if weight_name:
ddf2 = df[[dst_name, src_name, weight_name]]
Expand Down Expand Up @@ -180,12 +184,14 @@ def symmetrize(source_col, dest_col, value_col=None, multi=False,

Examples
--------
>>> from cugraph.structure.symmetrize import symmetrize
>> Download dataset from https://github.com/rapidsai/cugraph/datasets/...
>>> M = cudf.read_csv('datasets/karate.csv', delimiter=' ',
>>> dtype=['int32', 'int32', 'float32'], header=None)
>>> sources = cudf.Series(M['0'])
>>> destinations = cudf.Series(M['1'])
>>> values = cudf.Series(M['2'])
>>> src, dst, val = cugraph.symmetrize(sources, destinations, values)
>>> src, dst, val = symmetrize(sources, destinations, values)
"""

input_df = None
Expand Down