Loading...
Searching...
No Matches
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E > Class Template Reference

An undirected edge represents a connection between two vertices. More...

#include <Edge.hh>

Inheritance diagram for ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >:

Public Member Functions

 UndirectedEdge (const VertexId_P &_vertices, const E &_data, const double _weight, const EdgeId &_id=kNullId)
 Constructor.
 
VertexId From (const VertexId &_from) const override
 Get the destination end that is reachable from a source end of an edge.
 
VertexId To (const VertexId &_to) const override
 Get the source end that can reach the destination end of an edge.
 
- Public Member Functions inherited from ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::Edge< E >
 Edge (const VertexId_P &_vertices, const E &_data, const double _weight, const EdgeId &_id=kNullId)
 Constructor.
 
E & Data ()
 Get a mutable reference to the user data stored in the edge.
 
const E & Data () const
 Get a non-mutable reference to the user data stored in the edge.
 
EdgeId Id () const
 Get the edge Id.
 
void SetWeight (const double _newWeight)
 Set the cost of the edge.
 
bool Valid () const
 An edge is considered valid when its id is not kNullId.
 
VertexId_P Vertices () const
 Get the two vertices contained in the edge.
 
double Weight () const
 The cost of traversing the _from end to the other end of the edge.
 

Static Public Attributes

static UndirectedEdge< E > NullEdge
 An invalid undirected edge.
 

Detailed Description

template<typename E>
class ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >

An undirected edge represents a connection between two vertices.

The connection is bidirectional, it's possible to traverse the edge in both directions.

Constructor & Destructor Documentation

◆ UndirectedEdge()

template<typename E >
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >::UndirectedEdge ( const VertexId_P & _vertices,
const E & _data,
const double _weight,
const EdgeId & _id = kNullId )
inlineexplicit

Constructor.

Parameters
[in]_verticesThe vertices of the edge.
[in]_dataThe data stored in the edge.
[in]_weightThe weight (cost) of the edge.
[in]_idOptional unique id.

Member Function Documentation

◆ From()

template<typename E >
VertexId ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >::From ( const VertexId & _from) const
inlineoverridevirtual

Get the destination end that is reachable from a source end of an edge.

E.g.: Let's assume that we have an undirected edge (e1) with ends (v1) and (v2): (v1)–(v2). The operation e1.From(v1) returns (v2). The operation e1.From(v2) returns (v1).

E.g.: Let's assume that we have a directed edge (e2) with the tail end (v1) and the head end (v2): (v1)->(v2). The operation e2.From(v1) returns (v2). The operation e2.From(v2) returns kNullId.

Parameters
[in]_fromSource vertex.
Returns
The other vertex of the edge reachable from the "_from" vertex or kNullId otherwise.

Implements ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::Edge< E >.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::kNullId, ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::Edge< E >::Valid(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::Edge< E >::Vertices().

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >::To().

◆ To()

template<typename E >
VertexId ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >::To ( const VertexId & _to) const
inlineoverridevirtual

Get the source end that can reach the destination end of an edge.

E.g.: Let's assume that we have an undirected edge (e1) with ends (v1) and (v2): (v1)–(v2). The operation e1.To(v1) returns (v2). The operation e1.To(v2) returns (v1).

E.g.: Let's assume that we have a directed edge (e2) with the tail end (v1) and the head end (v2): (v1)->(v2). The operation e2.To(v1) returns kNullId. The operation e2.To(v2) returns v1.

Parameters
[in]_fromDestination vertex.
Returns
The other vertex of the edge that can reach "_to" vertex or kNullId otherwise.

Implements ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::Edge< E >.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >::From().

Member Data Documentation

◆ NullEdge

An invalid undirected edge.


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