Skip to content

Commit

Permalink
Merge branch 'branch-23.10' of github.com:rapidsai/cugraph into fix_l…
Browse files Browse the repository at this point in the history
…ouvain_to_handle_isolated_vertices
  • Loading branch information
naimnv committed Sep 28, 2023
2 parents 1dfe43f + f57119b commit 0886aa6
Show file tree
Hide file tree
Showing 38 changed files with 2,302 additions and 766 deletions.
1 change: 1 addition & 0 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugr
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/server/cugraph_service_server/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/pylibcugraph/pylibcugraph/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/nx-cugraph/nx_cugraph/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/nx-cugraph/_nx_cugraph/__init__.py

# Python pyproject.toml updates
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph/pyproject.toml
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cugraph/sampling_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace cugraph {
* std::get<1>(*edgelist_label_offsets) if @p edgelist_label_offsets.has_value() is true and 1
* otherwise and # hops = std::get<1>(*edgelist_hops) if edgelist_hops.has_value() is true and 1
* otherwise, valid only if at least one of @p edgelist_label_offsets.has_value() or @p
* edgelist_hops.has_value() is rue), renumber_map to query original vertices (size = # unique
* edgelist_hops.has_value() is true), renumber_map to query original vertices (size = # unique
* vertices or aggregate # unique vertices for every label), and label offsets to the renumber_map
* (size = std::get<1>(*edgelist_label_offsets) + 1, valid only if @p
* edgelist_label_offsets.has_value() is true).
Expand Down
127 changes: 71 additions & 56 deletions cpp/include/cugraph_c/sampling_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ typedef enum cugraph_prior_sources_behavior_t {
but exclude any vertex that has already been used as a source */
} cugraph_prior_sources_behavior_t;

/**
* @brief Selects the type of compression to use for the output samples.
*/
typedef enum cugraph_compression_type_t {
COO = 0, /** Outputs in COO format. Default. */
CSR, /** Compresses in CSR format. This means the row (src) column
is compressed into a row pointer. */
CSC, /** Compresses in CSC format. This means the col (dst) column
is compressed into a column pointer. */
DCSR, /** Compresses in DCSR format. This outputs an additional index
that avoids empty entries in the row pointer. */
DCSC /** Compresses in DCSC format. This outputs an additional index
that avoid empty entries in the col pointer. */
} cugraph_compression_type_t;

/**
* @brief Create sampling options object
*
Expand All @@ -225,6 +240,14 @@ cugraph_error_code_t cugraph_sampling_options_create(cugraph_sampling_options_t*
*/
void cugraph_sampling_set_renumber_results(cugraph_sampling_options_t* options, bool_t value);

/**
* @brief Set whether to compress per-hop (True) or globally (False)
*
* @param options - opaque pointer to the sampling options
* @param value - Boolean value to assign to the option
*/
void cugraph_sampling_set_compress_per_hop(cugraph_sampling_options_t* options, bool_t value);

/**
* @brief Set flag to sample with_replacement
*
Expand All @@ -241,6 +264,15 @@ void cugraph_sampling_set_with_replacement(cugraph_sampling_options_t* options,
*/
void cugraph_sampling_set_return_hops(cugraph_sampling_options_t* options, bool_t value);

/**
* @brief Set compression type
*
* @param options - opaque pointer to the sampling options
* @param value - Enum defining the compresion type
*/
void cugraph_sampling_set_compression_type(cugraph_sampling_options_t* options,
cugraph_compression_type_t value);

/**
* @brief Set prior sources behavior
*
Expand All @@ -265,62 +297,6 @@ void cugraph_sampling_set_dedupe_sources(cugraph_sampling_options_t* options, bo
*/
void cugraph_sampling_options_free(cugraph_sampling_options_t* options);

/**
* @brief Uniform Neighborhood Sampling
* @deprecated This call should be replaced with cugraph_uniform_neighbor_sample
*
* Returns a sample of the neighborhood around specified start vertices. Optionally, each
* start vertex can be associated with a label, allowing the caller to specify multiple batches
* of sampling requests in the same function call - which should improve GPU utilization.
*
* If label is NULL then all start vertices will be considered part of the same batch and the
* return value will not have a label column.
*
* @param [in] handle Handle for accessing resources
* @param [in] graph Pointer to graph. NOTE: Graph might be modified if the storage
* needs to be transposed
* @param [in] start_vertices Device array of start vertices for the sampling
* @param [in] start_vertex_labels Device array of start vertex labels for the sampling. The
* labels associated with each start vertex will be included in the output associated with results
* that were derived from that start vertex. We only support label of type INT32. If label is
* NULL, the return data will not be labeled.
* @param [in] label_list Device array of the labels included in @p start_vertex_labels. If
* @p label_to_comm_rank is not specified this parameter is ignored. If specified, label_list
* must be sorted in ascending order.
* @param [in] label_to_comm_rank Device array identifying which comm rank the output for a
* particular label should be shuffled in the output. If not specifed the data is not organized in
* output. If specified then the all data from @p label_list[i] will be shuffled to rank @p
* label_to_comm_rank[i]. If not specified then the output data will not be shuffled between ranks.
* @param [in] fanout Host array defining the fan out at each step in the sampling algorithm.
* We only support fanout values of type INT32
* @param [in/out] rng_state State of the random number generator, updated with each call
* @param [in] with_replacement
* Boolean value. If true selection of edges is done with
* replacement. If false selection is done without replacement.
* @param [in] return_hops Boolean value. If true include the hop number in the result,
* If false the hop number will not be included in result.
* @param [in] do_expensive_check
* A flag to run expensive checks for input arguments (if set to true)
* @param [in] result Output from the uniform_neighbor_sample call
* @param [out] error Pointer to an error object storing details of any error. Will
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
*/
cugraph_error_code_t cugraph_uniform_neighbor_sample_with_edge_properties(
const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
const cugraph_type_erased_device_array_view_t* start_vertices,
const cugraph_type_erased_device_array_view_t* start_vertex_labels,
const cugraph_type_erased_device_array_view_t* label_list,
const cugraph_type_erased_device_array_view_t* label_to_comm_rank,
const cugraph_type_erased_host_array_view_t* fan_out,
cugraph_rng_state_t* rng_state,
bool_t with_replacement,
bool_t return_hops,
bool_t do_expensive_check,
cugraph_sample_result_t** result,
cugraph_error_t** error);

/**
* @brief Uniform Neighborhood Sampling
*
Expand Down Expand Up @@ -374,6 +350,7 @@ cugraph_error_code_t cugraph_uniform_neighbor_sample(
cugraph_error_t** error);

/**
* @deprecated This call should be replaced with cugraph_sample_result_get_majors
* @brief Get the source vertices from the sampling algorithm result
*
* @param [in] result The result from a sampling algorithm
Expand All @@ -383,6 +360,7 @@ cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_sources(
const cugraph_sample_result_t* result);

/**
* @deprecated This call should be replaced with cugraph_sample_result_get_minors
* @brief Get the destination vertices from the sampling algorithm result
*
* @param [in] result The result from a sampling algorithm
Expand All @@ -391,6 +369,33 @@ cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_sources(
cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_destinations(
const cugraph_sample_result_t* result);

/**
* @brief Get the major vertices from the sampling algorithm result
*
* @param [in] result The result from a sampling algorithm
* @return type erased array pointing to the major vertices in device memory
*/
cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_majors(
const cugraph_sample_result_t* result);

/**
* @brief Get the minor vertices from the sampling algorithm result
*
* @param [in] result The result from a sampling algorithm
* @return type erased array pointing to the minor vertices in device memory
*/
cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_minors(
const cugraph_sample_result_t* result);

/**
* @brief Get the major offsets from the sampling algorithm result
*
* @param [in] result The result from a sampling algorithm
* @return type erased array pointing to the major offsets in device memory
*/
cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_major_offsets(
const cugraph_sample_result_t* result);

/**
* @brief Get the start labels from the sampling algorithm result
*
Expand Down Expand Up @@ -436,6 +441,15 @@ cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_edge_weight(
cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_hop(
const cugraph_sample_result_t* result);

/**
* @brief Get the label-hop offsets from the sampling algorithm result
*
* @param [in] result The result from a sampling algorithm
* @return type erased array pointing to the label-hop offsets
*/
cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_label_hop_offsets(
const cugraph_sample_result_t* result);

/**
* @brief Get the index from the sampling algorithm result
*
Expand All @@ -446,6 +460,7 @@ cugraph_type_erased_device_array_view_t* cugraph_sample_result_get_index(
const cugraph_sample_result_t* result);

/**
* @deprecated This call should be replaced with cugraph_sample_get_get_label_hop_offsets
* @brief Get the result offsets from the sampling algorithm result
*
* @param [in] result The result from a sampling algorithm
Expand Down
Loading

0 comments on commit 0886aa6

Please sign in to comment.