MeshLib
 
Loading...
Searching...
No Matches
MR::Graph Class Reference

mathematical graph consisting from vertices and undirected edges More...

#include <MRGraph.h>

Classes

struct  EndVertices
 

Public Types

using VertId = GraphVertId
 
using EdgeId = GraphEdgeId
 
using VertBitSet = GraphVertBitSet
 
using EdgeBitSet = GraphEdgeBitSet
 
using Neighbours = std::vector<EdgeId>
 
using NeighboursPerVertex = Vector<Neighbours, VertId>
 
using EndsPerEdge = Vector<EndVertices, EdgeId>
 

Public Member Functions

MRMESH_API void construct (NeighboursPerVertex neighboursPerVertex, EndsPerEdge endsPerEdge)
 constructs the graph from all valid vertices and edges
 
size_t vertSize () const
 returns the number of vertex records, including invalid ones
 
const VertBitSetvalidVerts () const
 returns all valid vertices in the graph
 
bool valid (VertId v) const
 returns true if given vertex is valid
 
size_t edgeSize () const
 returns the number of edge records, including invalid ones
 
const EdgeBitSetvalidEdges () const
 returns all valid edges in the graph
 
bool valid (EdgeId e) const
 returns true if given edge is valid
 
const Neighboursneighbours (VertId v) const
 returns all edges adjacent to given vertex
 
const EndVerticesends (EdgeId e) const
 returns the ends of given edge
 
MRMESH_API EdgeId findEdge (VertId a, VertId b) const
 finds and returns edge between vertices a and b; returns invalid edge otherwise
 
bool areNeighbors (VertId a, VertId b) const
 returns true if the vertices a and b are neighbors
 
MRMESH_API void merge (VertId remnant, VertId dead, std::function< void(EdgeId remnant, EdgeId dead)> onMergeEdges)
 
MRMESH_API bool checkValidity () const
 verifies that all internal data structures are valid
 

Detailed Description

mathematical graph consisting from vertices and undirected edges

Member Typedef Documentation

◆ EdgeBitSet

using MR::Graph::EdgeBitSet = GraphEdgeBitSet

◆ EdgeId

using MR::Graph::EdgeId = GraphEdgeId

◆ EndsPerEdge

◆ Neighbours

using MR::Graph::Neighbours = std::vector<EdgeId>

◆ NeighboursPerVertex

◆ VertBitSet

using MR::Graph::VertBitSet = GraphVertBitSet

◆ VertId

using MR::Graph::VertId = GraphVertId

Member Function Documentation

◆ areNeighbors()

bool MR::Graph::areNeighbors ( VertId a,
VertId b ) const
inlinenodiscard

returns true if the vertices a and b are neighbors

◆ checkValidity()

MRMESH_API bool MR::Graph::checkValidity ( ) const

verifies that all internal data structures are valid

◆ construct()

MRMESH_API void MR::Graph::construct ( NeighboursPerVertex neighboursPerVertex,
EndsPerEdge endsPerEdge )

constructs the graph from all valid vertices and edges

◆ edgeSize()

size_t MR::Graph::edgeSize ( ) const
inlinenodiscard

returns the number of edge records, including invalid ones

◆ ends()

const EndVertices & MR::Graph::ends ( EdgeId e) const
inlinenodiscard

returns the ends of given edge

◆ findEdge()

MRMESH_API EdgeId MR::Graph::findEdge ( VertId a,
VertId b ) const
nodiscard

finds and returns edge between vertices a and b; returns invalid edge otherwise

◆ merge()

MRMESH_API void MR::Graph::merge ( VertId remnant,
VertId dead,
std::function< void(EdgeId remnant, EdgeId dead)> onMergeEdges )

unites two vertices into one (deleting the second one), which leads to deletion and merge of some edges, for which callback is called

◆ neighbours()

const Neighbours & MR::Graph::neighbours ( VertId v) const
inlinenodiscard

returns all edges adjacent to given vertex

◆ valid() [1/2]

bool MR::Graph::valid ( EdgeId e) const
inlinenodiscard

returns true if given edge is valid

◆ valid() [2/2]

bool MR::Graph::valid ( VertId v) const
inlinenodiscard

returns true if given vertex is valid

◆ validEdges()

const EdgeBitSet & MR::Graph::validEdges ( ) const
inlinenodiscard

returns all valid edges in the graph

◆ validVerts()

const VertBitSet & MR::Graph::validVerts ( ) const
inlinenodiscard

returns all valid vertices in the graph

◆ vertSize()

size_t MR::Graph::vertSize ( ) const
inlinenodiscard

returns the number of vertex records, including invalid ones


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