Core 1.0
Public Member Functions | Protected Attributes | Friends | List of all members
GeometricGraph2 Class Reference

A simple geometric graph. More...

#include <geometricgraph.h>

Public Member Functions

 GeometricGraph2 ()
 Create an empty geometric graph.
 
 GeometricGraph2 (const QVector< Vector2 > &, bool=false)
 Create an empty geometric graph. More...
 
 GeometricGraph2 (const Mesh2 &)
 Create a geometric graph from a mesh. More...
 
void AddEdge (int, int, double)
 Add an edge to the graph. More...
 
void AddEdge (int, int)
 Add an edge to the graph. More...
 
int Edges () const
 Return the number of edges.
 
QPoint Edge (int) const
 Return the i-th edge as a pair or integers.
 
GeometricGraph2 Kruskal () const
 Compute the minimum spanning tree using Kruskal's algorithm.
 
GeometricGraph2 Nearest () const
 Compute the nearest geometric graph.
 
GeometricGraph2 Urquhart () const
 Generate the Urquhart graph. More...
 
GeometricGraph2 Relative () const
 Compute the relative neighbor graph. More...
 
GeometricGraph2 Gabriel () const
 Compute the Gabriel graph.
 
GeometricGraph2 Gamma (double) const
 Compute the gamma-skeleton graph. More...
 
GeometricGraph2 Beta (double, bool=false) const
 Compute the beta-skeleton graph, either using a circle or lens based definition. More...
 
GeometricGraph2 SubNearest (const Vector2 &, int) const
 Compute the minimum spanning tree using Kruskal's algorithm.
 
double Weight () const
 Compute the global weight of the geometric graph. More...
 
bool Exists (int, int) const
 Tests if an edge exists in the graph. More...
 
GeometricGraph2 Reverse () const
 Return the reversed geometric graph. More...
 
void Draw (QGraphicsScene &) const
 Draw the cluster. More...
 

Protected Attributes

std::vector< WeightEdge > edges
 Set of edges.
 

Friends

std::ostream & operator<< (std::ostream &, const GeometricGraph2 &)
 Overloaded output-stream operator. More...
 

Detailed Description

A simple geometric graph.

Geometric graphs.

Constructor & Destructor Documentation

◆ GeometricGraph2() [1/2]

GeometricGraph2::GeometricGraph2 ( const QVector< Vector2 > &  v,
bool  complete = false 
)
explicit

Create an empty geometric graph.

Parameters
vVector set.
completeBoolean to check if complete graph should be computed.

◆ GeometricGraph2() [2/2]

GeometricGraph2::GeometricGraph2 ( const Mesh2 mesh)
explicit

Create a geometric graph from a mesh.

Parameters
meshThe mesh.

Member Function Documentation

◆ AddEdge() [1/2]

void GeometricGraph2::AddEdge ( int  a,
int  b 
)

Add an edge to the graph.

Weight is computed from the points as the Euclidean distance

Parameters
a,bIndexes.

◆ AddEdge() [2/2]

void GeometricGraph2::AddEdge ( int  a,
int  b,
double  w 
)

Add an edge to the graph.

Parameters
a,bIndexes.
wWeight.

◆ Beta()

GeometricGraph2 GeometricGraph2::Beta ( double  beta,
bool  circle = false 
) const

Compute the beta-skeleton graph, either using a circle or lens based definition.

The Gabriel graph is the closed 1-skeleton and the relative neighborhood graph is the open 2-skeleton.

Parameters
betaBeta parameter, should be >1.
circleSet to true to use the circle-based definiton, lens-based otherwise.

◆ Draw()

void GeometricGraph2::Draw ( QGraphicsScene &  scene) const

Draw the cluster.

Parameters
sceneGraphics scene.

◆ Exists()

bool GeometricGraph2::Exists ( int  a,
int  b 
) const

Tests if an edge exists in the graph.

Parameters
a,bVertex indexes.

◆ Gamma()

GeometricGraph2 GeometricGraph2::Gamma ( double  gamma) const

Compute the gamma-skeleton graph.

Parameters
gammaGamma parameter, should be >1.

◆ Relative()

GeometricGraph2 GeometricGraph2::Relative ( ) const

Compute the relative neighbor graph.

An undirected graph defined on a set of points in the Euclidean plane by connecting two points if there does not exist a third point that is closer to both those than they are to each other.

Toussaint, G. T. The relative neighborhood graph of a finite planar set. Pattern Recognition, 12 (4): 261–268, 1980.

Jaromczyk, J.W.; Toussaint, G.T. Relative neighborhood graphs and their relatives. Proceedings of IEEE, 80 (9): 1502-1517, 1992.

◆ Reverse()

GeometricGraph2 GeometricGraph2::Reverse ( ) const

Return the reversed geometric graph.

The graph has the same number of edges but with opposite directions, and preserves weigth.

◆ Urquhart()

GeometricGraph2 GeometricGraph2::Urquhart ( ) const

Generate the Urquhart graph.

Formed by removing the longest edge from every triangle in the Delaunay triangulation, it was originally proposed as a fast method to compute the relative neighborhood graph.

See also
Mest::Delaunay

◆ Weight()

double GeometricGraph2::Weight ( ) const

Compute the global weight of the geometric graph.

Weight is defined as the sum of the weights of the edges.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const GeometricGraph2 g 
)
friend

Overloaded output-stream operator.

Parameters
gGeometric graph.
sStream.