Template Numerical Library version\ main:4e6e2c1
Loading...
Searching...
No Matches
TNL::Graphs::GraphView< Value, Device, Index, Orientation, AdjacencyMatrixView_ > Struct Template Reference

View type for Graph class. More...

#include <TNL/Graphs/GraphView.h>

Inheritance diagram for TNL::Graphs::GraphView< Value, Device, Index, Orientation, AdjacencyMatrixView_ >:
[legend]
Collaboration diagram for TNL::Graphs::GraphView< Value, Device, Index, Orientation, AdjacencyMatrixView_ >:
[legend]

Public Types

using AdjacencyMatrixView = AdjacencyMatrixView_
 Type of the adjacency matrix view.
using ConstAdjacencyMatrixView = typename AdjacencyMatrixView_::ConstViewType
 Type of constant view of the adjacency matrix.
using ConstVertexView = typename VertexView::ConstVertexView
 Type of constant graph nodes view.
using ConstViewType = GraphView< std::add_const_t< Value >, Device, Index, Orientation, ConstAdjacencyMatrixView >
 Type of constant view of the graph.
using DeviceType = Device
 Type of device where the graph will be operating.
using GraphType = Orientation
 Type of the graph - directed or undirected.
using IndexType = Index
 Type for indexing of the graph nodes.
template<typename Value_ = Value, typename Device_ = Device, typename Index_ = Index, typename Orientation_ = Orientation, typename AdjacencyMatrixView__ = AdjacencyMatrixView>
using Self = GraphView< Value_, Device_, Index_, Orientation_, AdjacencyMatrixView__ >
using ValueType = Value
 Type for weights of the graph edges.
using VertexView = GraphVertexView< AdjacencyMatrixView, Orientation >
 Type of the graph nodes view.
using ViewType = GraphView< Value, Device, Index, Orientation, AdjacencyMatrixView >
 Type of view of the graph.
Public Types inherited from TNL::Graphs::GraphBase< Value, Device, Index, Orientation, AdjacencyMatrixView_ >
using AdjacencyMatrixView = AdjacencyMatrixView_
 Type of the adjacency matrix view.
using ConstAdjacencyMatrixView = typename AdjacencyMatrixView::ConstViewType
 Type of constant view of the adjacency matrix.
using ConstVertexView = typename VertexView::ConstVertexView
using DeviceType = Device
 Type of device where the graph will be operating.
using GraphOrientation = Orientation
 Type of the graph - directed or undirected.
using IndexType = Index
 Type for indexing of the graph nodes.
using ValueType = Value
 Type for weights of the graph edges.
using VertexView = GraphVertexView< AdjacencyMatrixView, Orientation >

Public Member Functions

__cuda_callable__ GraphView ()=default
 Default constructor.
__cuda_callable__ GraphView (AdjacencyMatrixView &&adjacencyMatrixView)
 Constructor with sparse matrix view as an adjacency matrix.
__cuda_callable__ GraphView (AdjacencyMatrixView &adjacencyMatrixView)
 Constructor with sparse matrix view as an adjacency matrix.
__cuda_callable__ void bind (AdjacencyMatrixView &&adjacencyMatrixView)
 Method for rebinding (reinitialization) using another sparse matrix view as an adjacency matrix.
void __cuda_callable__ bind (AdjacencyMatrixView &adjacencyMatrixView)
 Method for rebinding (reinitialization) using another sparse matrix view as an adjacency matrix.
void __cuda_callable__ bind (GraphView &&graphView)
 Method for rebinding (reinitialization) using another graph view.
void __cuda_callable__ bind (GraphView &graphView)
 Method for rebinding (reinitialization) using another graph view.
__cuda_callable__ ConstViewType getConstView () const
 Returns a non-modifiable view of the sparse matrix.
__cuda_callable__ ViewType getView ()
 Returns a modifiable view of the sparse matrix.
Public Member Functions inherited from TNL::Graphs::GraphBase< Value, Device, Index, Orientation, AdjacencyMatrixView_ >
 GraphBase ()=default
 Default constructor.
 GraphBase (const GraphBase &)=default
 Copy constructor.
 GraphBase (GraphBase &&)=default
 Move constructor.
 ~GraphBase ()=default
 Destructor.
__cuda_callable__ AdjacencyMatrixViewgetAdjacencyMatrixView ()
 Returns the view of adjacency matrix of the graph.
__cuda_callable__ const AdjacencyMatrixViewgetAdjacencyMatrixView () const
 Returns the constant view of adjacency matrix of the graph.
__cuda_callable__ IndexType getEdgeCount () const
 Returns the number of edges in the graph.
__cuda_callable__ ValueType getEdgeWeight (IndexType vertexIdx, IndexType edgeIdx) const
__cuda_callable__ VertexView getVertex (IndexType vertexIdx)
__cuda_callable__ ConstVertexView getVertex (IndexType vertexIdx) const
__cuda_callable__ IndexType getVertexCount () const
 Returns the number of nodes in the graph.
__cuda_callable__ IndexType getVertexDegree (IndexType nodeIdx) const
GraphBaseoperator= (const GraphBase &)=delete
 Copy-assignment operator.
GraphBaseoperator= (GraphBase &&)=delete
 Move-assignment operator.
bool operator== (const GraphBase &other) const
 Comparisons operator.
__cuda_callable__ void setEdgeWeight (IndexType vertexIdx, IndexType edgeIdx, const ValueType &value)

Static Public Member Functions

static constexpr bool isDirected ()
 Checks if the graph is directed.
static constexpr bool isUndirected ()
 Checks if the graph is undirected.
Static Public Member Functions inherited from TNL::Graphs::GraphBase< Value, Device, Index, Orientation, AdjacencyMatrixView_ >
static std::string getSerializationType ()
 Returns the type of serialization used for the graph.
static constexpr bool isDirected ()
 Checks if the graph is directed.
static constexpr bool isUndirected ()
 Checks if the graph is undirected.

Protected Types

using Base = GraphBase< Value, Device, Index, Orientation, AdjacencyMatrixView_ >

Additional Inherited Members

Protected Attributes inherited from TNL::Graphs::GraphBase< Value, Device, Index, Orientation, AdjacencyMatrixView_ >
AdjacencyMatrixView adjacencyMatrixView

Detailed Description

template<typename Value, typename Device, typename Index, typename Orientation, typename AdjacencyMatrixView_>
struct TNL::Graphs::GraphView< Value, Device, Index, Orientation, AdjacencyMatrixView_ >

View type for Graph class.

GraphView provides a lightweight, non-owning view of a Graph object. It can be used to access graph data without copying, making it efficient for passing graphs to functions or kernels.

Member Function Documentation

◆ getConstView()

template<typename Value, typename Device, typename Index, typename Orientation, typename AdjacencyMatrixView_>
__cuda_callable__ ConstViewType TNL::Graphs::GraphView< Value, Device, Index, Orientation, AdjacencyMatrixView_ >::getConstView ( ) const
nodiscard

Returns a non-modifiable view of the sparse matrix.

Returns
sparse matrix view.

◆ getView()

template<typename Value, typename Device, typename Index, typename Orientation, typename AdjacencyMatrixView_>
__cuda_callable__ ViewType TNL::Graphs::GraphView< Value, Device, Index, Orientation, AdjacencyMatrixView_ >::getView ( )
nodiscard

Returns a modifiable view of the sparse matrix.

Returns
sparse matrix view.

The documentation for this struct was generated from the following file: