Generic edge class. More...
#include <Edge.hh>
Public Member Functions | |
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. | |
virtual VertexId | From (const VertexId &_from) const =0 |
Get the destination end that is reachable from a source end of an edge. | |
EdgeId | Id () const |
Get the edge Id. | |
void | SetWeight (const double _newWeight) |
Set the cost of the edge. | |
virtual VertexId | To (const VertexId &_to) const =0 |
Get the source end that can reach the destination end of an 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. | |
Generic edge class.
An edge has two ends and some constraint between them. For example, a directed edge only allows traversing the edge in one direction.
|
inlineexplicit |
Constructor.
[in] | _vertices | The vertices of the edge. |
[in] | _data | The data stored in the edge. |
[in] | _weight | The weight (cost) of the edge. |
[in] | _id | Optional unique id. |
|
inline |
Get a mutable reference to the user data stored in the edge.
|
inline |
Get a non-mutable reference to the user data stored in the edge.
|
pure virtual |
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.
[in] | _from | Source vertex. |
Implemented in ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::DirectedEdge< E >, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >.
|
inline |
Get the edge Id.
|
inline |
Set the cost of the edge.
[in] | _newWeight | The new cost. |
|
pure virtual |
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.
[in] | _from | Destination vertex. |
Implemented in ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::DirectedEdge< E >, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >.
|
inline |
An edge is considered valid when its id is not kNullId.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::kNullId.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >::From(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::Edge< E >::Vertices().
|
inline |
Get the two vertices contained in the edge.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::kNullId, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::Edge< E >::Valid().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::UndirectedEdge< E >::From(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::DirectedEdge< E >::Head(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::graph::DirectedEdge< E >::Tail().
|
inline |
The cost of traversing the _from end to the other end of the edge.