Solar
Public Member Functions | Friends | List of all members
SolAR::datastructure::CovisibilityGraph Class Reference

A covisibility graph of keyframes. This class provides a covisibility graph where each vertex is an id of a keyframe and each edge is weighted by the number of common cloud points between two keyframes. More...

#include <CovisibilityGraph.h>

Inheritance diagram for SolAR::datastructure::CovisibilityGraph:
Inheritance graph
[legend]
Collaboration diagram for SolAR::datastructure::CovisibilityGraph:
Collaboration graph
[legend]

Public Member Functions

 CovisibilityGraph ()=default
 CovisibilityGraph constructor.
 
 CovisibilityGraph (const CovisibilityGraph &other)=default
 
CovisibilityGraphoperator= (const CovisibilityGraph &other)=default
 
 ~CovisibilityGraph ()=default
 ~CovisibilityGraph
 
FrameworkReturnCode increaseEdge (uint32_t node1_id, uint32_t node2_id, float weight)
 This method allow to increase edge between 2 nodes. More...
 
FrameworkReturnCode decreaseEdge (uint32_t node1_id, uint32_t node2_id, float weight)
 This method allow to decrease edge between 2 nodes. More...
 
FrameworkReturnCode removeEdge (uint32_t node1_id, uint32_t node2_id)
 This method allow to remove an edge between 2 nodes. More...
 
FrameworkReturnCode getEdge (uint32_t node1_id, uint32_t node2_id, float &weight) const
 This method allow to get edge between 2 nodes. More...
 
bool isEdge (const uint32_t node1_id, const uint32_t node2_id) const
 This method allow to verify that exist an edge between 2 nodes. More...
 
FrameworkReturnCode getAllNodes (std::set< uint32_t > &nodes_id) const
 This method allow to get all nodes of the graph. More...
 
FrameworkReturnCode suppressNode (const uint32_t node_id)
 This method allow to suppress a node of the graph. More...
 
FrameworkReturnCode getNeighbors (const uint32_t node_id, const float minWeight, std::vector< uint32_t > &neighbors, const uint32_t maxNbNeighbors=0) const
 This method allow to get neighbors of a node in the graph. More...
 
FrameworkReturnCode minimalSpanningTree (std::vector< std::tuple< uint32_t, uint32_t, float > > &edges_weights, float &minTotalWeights)
 This method allow to get minimal spanning tree of the graph. More...
 
FrameworkReturnCode maximalSpanningTree (std::vector< std::tuple< uint32_t, uint32_t, float > > &edges_weights, float &maxTotalWeights)
 This method allow to get maximal spanning tree of the graph. More...
 
FrameworkReturnCode getShortestPath (const uint32_t node1_id, const uint32_t node2_id, std::vector< uint32_t > &path)
 This method allow to get the shortest (by number of vertices) path between 2 nodes. More...
 
FrameworkReturnCode display () const
 This method allow to display all vertices and weighted edges of the covisibility graph.
 
template<typename Archive >
void serialize (Archive &ar, ATTRIBUTE(maybe_unused) const unsigned int version)
 
- Public Member Functions inherited from SolAR::datastructure::Lockable
 Lockable ()=default
 LockableCollection constructor.
 
std::unique_lock< std::mutex > acquireLock ()
 This method returns the point cloud. More...
 
void lock ()
 
void unlock ()
 
bool tryLock ()
 

Friends

class boost::serialization::access
 

Detailed Description

A covisibility graph of keyframes. This class provides a covisibility graph where each vertex is an id of a keyframe and each edge is weighted by the number of common cloud points between two keyframes.

Member Function Documentation

◆ decreaseEdge()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::decreaseEdge ( uint32_t  node1_id,
uint32_t  node2_id,
float  weight 
)

This method allow to decrease edge between 2 nodes.

Parameters
[in]idof 1st node
[in]idof 2nd node
[in]weightto decrease
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ getAllNodes()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::getAllNodes ( std::set< uint32_t > &  nodes_id) const

This method allow to get all nodes of the graph.

Parameters
[out]idsof all nodes
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ getEdge()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::getEdge ( uint32_t  node1_id,
uint32_t  node2_id,
float &  weight 
) const

This method allow to get edge between 2 nodes.

Parameters
[in]idof 1st node
[in]idof 2nd node
[out]weightof the edge
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ getNeighbors()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::getNeighbors ( const uint32_t  node_id,
const float  minWeight,
std::vector< uint32_t > &  neighbors,
const uint32_t  maxNbNeighbors = 0 
) const

This method allow to get neighbors of a node in the graph.

Parameters
[in]node_idid of the node to get neighbors
[in]minWeightmin value between this node and a neighbor to accept
[out]neighborsa vector of neighbors sorted to greater weighted edge.
[in]maxNbNeighborsthe maximum number of neighbors. If it is zero, find all neighbors.
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ getShortestPath()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::getShortestPath ( const uint32_t  node1_id,
const uint32_t  node2_id,
std::vector< uint32_t > &  path 
)

This method allow to get the shortest (by number of vertices) path between 2 nodes.

Parameters
[in]idof 1st node
[in]idof 2nd node
[out]theshortest path
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ increaseEdge()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::increaseEdge ( uint32_t  node1_id,
uint32_t  node2_id,
float  weight 
)

This method allow to increase edge between 2 nodes.

Parameters
[in]idof 1st node
[in]idof 2nd node
[in]weightto increase
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ isEdge()

bool SolAR::datastructure::CovisibilityGraph::isEdge ( const uint32_t  node1_id,
const uint32_t  node2_id 
) const

This method allow to verify that exist an edge between 2 nodes.

Parameters
[in]idof 1st node
[in]idof 2nd node
Returns
true if exist, else false

◆ maximalSpanningTree()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::maximalSpanningTree ( std::vector< std::tuple< uint32_t, uint32_t, float > > &  edges_weights,
float &  maxTotalWeights 
)

This method allow to get maximal spanning tree of the graph.

Parameters
[out]edges_weightsthe maximal spanning tree graph including edges with weights
[out]maxTotalWeightscost of the maximal spanning tree graph
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ minimalSpanningTree()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::minimalSpanningTree ( std::vector< std::tuple< uint32_t, uint32_t, float > > &  edges_weights,
float &  minTotalWeights 
)

This method allow to get minimal spanning tree of the graph.

Parameters
[out]edges_weightsthe minimal spanning tree graph including edges with weights
[out]minTotalWeightscost of the minimal spanning tree graph
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ removeEdge()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::removeEdge ( uint32_t  node1_id,
uint32_t  node2_id 
)

This method allow to remove an edge between 2 nodes.

Parameters
[in]idof 1st node
[in]idof 2nd node
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

◆ suppressNode()

FrameworkReturnCode SolAR::datastructure::CovisibilityGraph::suppressNode ( const uint32_t  node_id)

This method allow to suppress a node of the graph.

Parameters
[in]idof the node to suppress
Returns
FrameworkReturnCode::SUCCESS if the addition succeed, else FrameworkReturnCode::_ERROR.

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