count_if_v.cuh#

namespace cugraph

Functions

template<typename GraphViewType, typename VertexValueInputIterator, typename VertexOp>
GraphViewType::vertex_type count_if_v(
raft::handle_t const &handle,
GraphViewType const &graph_view,
VertexValueInputIterator vertex_value_input_first,
VertexOp v_op,
bool do_expensive_check = false
)

Count the number of vertices that satisfies the given predicate.

This version iterates over the entire set of graph vertices. This function is inspired by thrust::count_if().

Template Parameters:
  • GraphViewType – Type of the passed non-owning graph object.

  • VertexValueInputIterator – Type of the iterator for vertex property values.

  • VertexOp – Type of the unary predicate operator.

Parameters:
  • handle – RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and handles to various CUDA libraries) to run graph algorithms.

  • graph_view – Non-owning graph object.

  • vertex_value_input_first – Iterator pointing to the vertex property values for the first (inclusive) vertex (assigned to this process in multi-GPU). vertex_value_input_last (exclusive) is deduced as vertex_value_input_first + graph_view.local_vertex_partition_range_size().

  • v_op – Binary operator takes vertex ID and *(vertex_value_input_first + i) (where i is [0, graph_view.local_vertex_partition_range_size())) and returns true if this vertex should be included in the returned count.

  • do_expensive_check – A flag to run expensive checks for input arguments (if set to true).

Returns:

GraphViewType::vertex_type Number of times v_op returned true.

namespace detail
template<typename vertex_t, typename VertexValueInputIterator, typename VertexOp>
struct count_if_call_v_op_t

Public Functions

inline __device__ bool operator() (vertex_t i)

Public Members

vertex_t local_vertex_partition_range_first#
VertexValueInputIterator vertex_value_input_first#
VertexOp v_op#