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 IndexSetgetVertexNeighbors (unsigned index) const
 Returns the set of edges connected to a given vertex. More...
 

Protected Attributes

std::map< Edge::Key, floatm_edges
 Graph edges. More...
 
std::vector< IndexSetm_vertexNeighbors
 Set of neighbors for each vertex. More...
 

Detailed Description

Generic graph structure.

Definition at line 62 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

Member Typedef Documentation

◆ IndexSet

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

Set of indexes.

Definition at line 68 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

Constructor & Destructor Documentation

◆ Graph()

Graph::Graph ( )
inline

Default constructor.

Definition at line 65 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

Member Function Documentation

◆ addEdge()

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

Adds or updates the edge (v1,v2)

Definition at line 109 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

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.

Definition at line 94 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

References m_edges.

◆ getVertexNeighbors()

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

Returns the set of edges connected to a given vertex.

Definition at line 118 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

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.

Definition at line 74 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

References m_edges, m_vertexNeighbors, and vertexCount().

Referenced by ccMinimumSpanningTreeForNormsDirection::OrientNormals().

◆ vertexCount()

unsigned Graph::vertexCount ( ) const
inline

Returns the number of vertices.

Definition at line 88 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

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)

Definition at line 98 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

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.

Definition at line 124 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

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

◆ m_vertexNeighbors

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

Set of neighbors for each vertex.

Definition at line 127 of file ecvMinimumSpanningTreeForNormsDirection.cpp.

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


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