PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
Adjacency.h File Reference

Adjacency matrix utilities. More...

#include "pbat/Aliases.h"
#include "pbat/common/ArgSort.h"
#include "pbat/common/Eigen.h"
#include "pbat/common/Indexing.h"
#include <concepts>
#include <iterator>
#include <tuple>
#include <vector>

Go to the source code of this file.

Classes

struct  pbat::graph::WeightedEdgeTraits< TWeightedEdge >
 Traits for WeightedEdge. More...
 

Namespaces

namespace  pbat
 The main namespace of the library.
 
namespace  pbat::graph
 

Typedefs

template<class TWeight = Scalar, class TIndex = Index>
using pbat::graph::WeightedEdge = Eigen::Triplet<TWeight, TIndex>
 Weighted edge (wrapper around Eigen triplet type)
 

Functions

template<class TWeightedEdgeIterator, class TWeightedEdge = typename std::iterator_traits<TWeightedEdgeIterator>::value_type, class TScalar = typename WeightedEdgeTraits<TWeightedEdge>::ScalarType, class TIndex = typename WeightedEdgeTraits<TWeightedEdge>::IndexType>
auto pbat::graph::AdjacencyMatrixFromEdges (TWeightedEdgeIterator begin, TWeightedEdgeIterator end, TIndex m=TIndex(-1), TIndex n=TIndex(-1)) -> Eigen::SparseMatrix< TScalar, Eigen::RowMajor, TIndex >
 Construct adjacency matrix from edge/triplet list.
 
template<class TDerivedA, class TScalar = typename TDerivedA::Scalar, std::integral TIndex = typename TDerivedA::StorageIndex>
auto pbat::graph::AdjacencyMatrixPrefix (Eigen::SparseCompressedBase< TDerivedA > const &A)
 Non-owning wrapper around the offset pointers of a compressed sparse matrix.
 
template<class TDerivedA, class TScalar = typename TDerivedA::Scalar, std::integral TIndex = typename TDerivedA::StorageIndex>
auto pbat::graph::AdjacencyMatrixIndices (Eigen::SparseCompressedBase< TDerivedA > const &A)
 Non-owning wrapper around the indices of a compressed sparse matrix.
 
template<class TDerivedA, class TScalar = typename TDerivedA::Scalar, std::integral TIndex = typename TDerivedA::StorageIndex>
auto pbat::graph::AdjacencyMatrixWeights (Eigen::SparseCompressedBase< TDerivedA > const &A)
 Non-owning wrapper around the weights of a compressed sparse matrix.
 
template<class TDerivedP, std::integral TIndex = typename TDerivedP::Scalar>
auto pbat::graph::MapToAdjacency (Eigen::DenseBase< TDerivedP > const &p, TIndex n=TIndex(-1)) -> std::tuple< Eigen::Vector< TIndex, Eigen::Dynamic >, Eigen::Vector< TIndex, Eigen::Dynamic > >
 Construct adjacency list in compressed sparse format from a map p s.t. p(i) is the index of the vertex adjacent to i.
 
template<class TDerivedA, class TScalar = typename TDerivedA::Scalar, std::integral TIndex = typename TDerivedA::StorageIndex>
auto pbat::graph::MatrixToAdjacency (Eigen::SparseCompressedBase< TDerivedA > const &A)
 Obtain the offset and indices arrays of an input adjacency matrix.
 
template<class TDerivedA, class TScalar = typename TDerivedA::Scalar, std::integral TIndex = typename TDerivedA::StorageIndex>
auto pbat::graph::MatrixToWeightedAdjacency (Eigen::SparseCompressedBase< TDerivedA > const &A)
 Construct adjacency list in compressed sparse format from an input adjacency matrix.
 
template<class TIndex = Index>
auto pbat::graph::ListOfListsToAdjacency (std::vector< std::vector< TIndex > > const &lil)
 Construct adjacency list in compressed sparse format from an input adjacency list in list of lists format.
 
template<class TDerivedPtr, class TDerivedAdj, class TIndex = typename TDerivedPtr::Scalar, class Func>
void pbat::graph::ForEachEdge (Eigen::DenseBase< TDerivedPtr > &ptr, Eigen::DenseBase< TDerivedAdj > &adj, Func &&f)
 Edge iteration over the adjacency list in compressed sparse format.
 
template<class TDerivedPtr, class TDerivedAdj, class TIndex = typename TDerivedPtr::Scalar, class Func>
void pbat::graph::RemoveEdges (Eigen::DenseBase< TDerivedPtr > &ptr, Eigen::DenseBase< TDerivedAdj > &adj, Func fShouldDeleteEdge)
 In-place removal of edges from the adjacency list in compressed sparse format.
 

Detailed Description

Adjacency matrix utilities.

Author
Quoc-Minh Ton-That (tonth.nosp@m.at.q.nosp@m.uocmi.nosp@m.nh@g.nosp@m.mail..nosp@m.com)
Date
2025-02-10