Graph Service
Programming interface
All types and functions in this section are declared in the
oneapi::dal::preview
namespace and are available via inclusion of the
oneapi/dal/graph/service_functions.hpp
header file.The graph service is a set of functions that allow you to get access to the
elements and characteristics of the graph, such as vertex degree
or edge attribute.
Graph service functions are defined as function templates with
Graph
as a template parameter. Graph service functions introduce aliases
to graph_traits
as shown below.Related types
Aliases is a way to access graph types using shorter notation.
Alias | Value |
---|---|
graph_allocator<G> | graph_traits<G>::allocator_type |
graph_user_value_type<G> | graph_traits<G>::graph_user_value_type |
vertex_user_value_type<G> | graph_traits<G>::vertex_user_value_type |
edge_user_value_type<G> | graph_traits<G>::edge_user_value_type |
vertex_type<G> | graph_traits<G>::vertex_type |
vertex_size_type<G> | graph_traits<G>::vertex_size_type |
edge_size_type<G> | graph_traits<G>::edge_size_type |
vertex_edge_size_type<G> | graph_traits<G>::vertex_edge_size_type |
vertex_outward_edge_size_type<G> | graph_traits<G>::vertex_outward_edge_size_type |
vertex_edge_iterator_type<G> | graph_traits<G>::vertex_edge_iterator_type |
const_vertex_edge_iterator_type<G> | graph_traits<G>::const_vertex_edge_iterator_type |
vertex_edge_range_type<G> | graph_traits<G>::vertex_edge_range_type |
const_vertex_edge_range_type<G> | graph_traits<G>::const_vertex_edge_range_type |
const_vertex_outward_edge_range_type<G> | graph_traits<G>::const_vertex_outward_edge_range_type |
Graph service functions
Any service function has the following pattern:
template <typename Graph>
return_type<Graph> get_[graph_element](const Graph& g, ...);
- Returns the range of the vertex neighbors for the specified vertex.
- Template Parameters
- Graph– Type of the graph.
- Parameters
- g– Input graph object.
- u– Vertex index.
- Returns the range of the vertex outward neighbors for the specified vertex.
- Template Parameters
- Graph– Type of the graph.
- Parameters
- g– Input graph object.
- u– Vertex index.
- Returns the value of an edge (u, v).
- Template Parameters
- Graph– Type of the graph.
- Parameters
- u– Source vertex index.
- v– Destination vertex index.
Usage example
using graph_type = ...;
const my_graph_type g = ...;
std::cout << "The number of vertices: " << oneapi::dal::preview::get_vertex_count(g) << std::endl;
std::cout << "The number of edges: " << oneapi::dal::preview::get_edge_count(g) << std::endl;
Service functions for supported graphs
This section contains description of service functions
supported for the specified graph types.
Service function | Valid graph concepts |
---|---|
get_vertex_count | |
get_edge_count | |
get_vertex_degree | |
get_vertex_outward_degree | |
get_vertex_neighbors | |
get_vertex_outward_neighbors | |
get_edge_value |