Lagrange
AdjacencyList< Index > Class Template Reference

Adjacency list. More...

#include <lagrange/utils/AdjacencyList.h>

Public Types

using ValueArray = std::vector< Index >
 
using IndexArray = std::vector< size_t >
 

Public Member Functions

 AdjacencyList (ValueArray data, IndexArray indices)
 Initialize adjacency list data. More...
 
size_t get_num_entries () const
 Get total number of entries. More...
 
span< const Index > get_neighbors (size_t i) const
 Get adjacency list of entry i. More...
 
size_t get_num_neighbors (size_t i) const
 Get the number of neighbors of a given entry. More...
 

Detailed Description

template<typename Index>
class lagrange::AdjacencyList< Index >

Adjacency list.

Template Parameters
IndexThe index type.

Constructor & Destructor Documentation

◆ AdjacencyList()

AdjacencyList ( ValueArray  data,
IndexArray  indices 
)
inline

Initialize adjacency list data.

Parameters
dataThe flattened adjacency list for all entries.
indicesThe starting index of adjacency list for each entry. This list should have size num_entries + 1, where entry i is adjacent to entries from m_data[i] (included) to m_data[i+1](not included).

Member Function Documentation

◆ get_num_entries()

size_t get_num_entries ( ) const
inline

Get total number of entries.

Returns
The total number of entries.

◆ get_neighbors()

span< const Index > get_neighbors ( size_t  i) const
inline

Get adjacency list of entry i.

Parameters
[in]iThe query entry index.
Returns
A list of adjacency entries.

◆ get_num_neighbors()

size_t get_num_neighbors ( size_t  i) const
inline

Get the number of neighbors of a given entry.

Parameters
iThe query entry.
Returns
The number of neighbors to i'th entry.

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