ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Graph Class Reference

Generic graph structure. More...

Public Types

typedef std::set< unsigned > IndexSet
 Set of indexes. More...
 

Public Member Functions

 Graph ()
 Default constructor. More...
 
bool reserve (unsigned vertexCount)
 Reserves memory for graph. More...
 
unsigned vertexCount () const
 Returns the number of vertices. More...
 
size_t edgeCount () const
 Returns the number of edges. More...
 
float weight (unsigned v1, unsigned v2) const
 
void addEdge (unsigned v1, unsigned v2, float weight=0.0f)
 Adds or updates the edge (v1,v2) More...
 
const IndexSet & getVertexNeighbors (unsigned index) const
 Returns the set of edges connected to a given vertex. More...
 

Protected Attributes

std::map< Edge::Key, float > m_edges
 Graph edges. More...
 
std::vector< IndexSet > m_vertexNeighbors
 Set of neighbors for each vertex. More...
 

Detailed Description

Generic graph structure.

Member Typedef Documentation

◆ IndexSet

typedef std::set<unsigned> Graph::IndexSet

Set of indexes.

Constructor & Destructor Documentation

◆ Graph()

Graph::Graph ( )
inline

Default constructor.

Member Function Documentation

◆ addEdge()

void Graph::addEdge ( unsigned  v1,
unsigned  v2,
float  weight = 0.0f 
)
inline

Adds or updates the edge (v1,v2)

References Edge::ConstructKey(), m_edges, m_vertexNeighbors, cloudViewer::core::make_pair(), and weight().

Referenced by ComputeMSTGraphAtLevel().

◆ edgeCount()

size_t Graph::edgeCount ( ) const
inline

Returns the number of edges.

References m_edges.

◆ getVertexNeighbors()

const IndexSet& Graph::getVertexNeighbors ( unsigned  index) const
inline

Returns the set of edges connected to a given vertex.

References m_vertexNeighbors.

◆ reserve()

bool Graph::reserve ( unsigned  vertexCount)
inline

Reserves memory for graph.

Must be called before using the structure! Clears the structure as well.

References m_edges, m_vertexNeighbors, and vertexCount().

Referenced by ccMinimumSpanningTreeForNormsDirection::OrientNormals().

◆ vertexCount()

unsigned Graph::vertexCount ( ) const
inline

Returns the number of vertices.

References m_vertexNeighbors.

Referenced by reserve().

◆ weight()

float Graph::weight ( unsigned  v1,
unsigned  v2 
) const
inline

Returns the weight associated to an edge (if it exists - returns -1 otherwise)

References Edge::ConstructKey(), m_edges, and m_vertexNeighbors.

Referenced by addEdge().

Member Data Documentation

◆ m_edges

std::map<Edge::Key, float> Graph::m_edges
protected

Graph edges.

Referenced by addEdge(), edgeCount(), reserve(), and weight().

◆ m_vertexNeighbors

std::vector<IndexSet> Graph::m_vertexNeighbors
protected

Set of neighbors for each vertex.

Referenced by addEdge(), getVertexNeighbors(), reserve(), vertexCount(), and weight().


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