A directed edge represents a connection between two vertices. The connection is unidirectional, it's only possible to traverse the edge in one direction (from the tail to the head). More...
#include <Edge.hh>
Public Member Functions | |
DirectedEdge (const VertexId_P &_vertices, const E &_data, const double _weight, const EdgeId &_id=kNullId) | |
Constructor. More... | |
VertexId | From (const VertexId &_from) const override |
Get the destination end that is reachable from a source end of an edge. More... | |
VertexId | Head () const |
Get the Id of the head vertex in this edge. More... | |
VertexId | Tail () const |
Get the Id of the tail vertex in this edge. More... | |
VertexId | To (const VertexId &_to) const override |
Get the source end that can reach the destination end of an edge. More... | |
Public Member Functions inherited from Edge< E > | |
Edge (const VertexId_P &_vertices, const E &_data, const double _weight, const EdgeId &_id=kNullId) | |
Constructor. More... | |
E & | Data () |
Get a mutable reference to the user data stored in the edge. More... | |
const E & | Data () const |
Get a non-mutable reference to the user data stored in the edge. More... | |
EdgeId | Id () const |
Get the edge Id. More... | |
void | SetWeight (const double _newWeight) |
Set the cost of the edge. More... | |
bool | Valid () const |
An edge is considered valid when its id is not kNullId. More... | |
VertexId_P | Vertices () const |
Get the two vertices contained in the edge. More... | |
double | Weight () const |
The cost of traversing the _from end to the other end of the edge. More... | |
Static Public Attributes | |
static DirectedEdge< E > | NullEdge |
An invalid directed edge. More... | |
Detailed Description
template<typename E>
class ignition::math::graph::DirectedEdge< E >
A directed edge represents a connection between two vertices. The connection is unidirectional, it's only possible to traverse the edge in one direction (from the tail to the head).
Constructor & Destructor Documentation
◆ DirectedEdge()
|
inlineexplicit |
Constructor.
- Parameters
-
[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.
Member Function Documentation
◆ From()
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] _from Source vertex.
- Returns
- The other vertex of the edge reachable from the "_from" vertex or kNullId otherwise.
Implements Edge< E >.
References DirectedEdge< E >::Head(), ignition::math::graph::kNullId, and DirectedEdge< E >::Tail().
◆ Head()
|
inline |
Get the Id of the head vertex in this edge.
- Returns
- An id of the head vertex in this edge.
- See also
- Tail()
References Edge< E >::Vertices().
Referenced by DirectedEdge< E >::From(), and DirectedEdge< E >::To().
◆ Tail()
|
inline |
Get the Id of the tail vertex in this edge.
- Returns
- An id of the tail vertex in this edge.
- See also
- Head()
References Edge< E >::Vertices().
Referenced by DirectedEdge< E >::From(), and DirectedEdge< E >::To().
◆ To()
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] _to Destination vertex.
- Returns
- The other vertex of the edge that can reach "_to" vertex or kNullId otherwise.
Implements Edge< E >.
References DirectedEdge< E >::Head(), ignition::math::graph::kNullId, and DirectedEdge< E >::Tail().
Member Data Documentation
◆ NullEdge
|
static |
An invalid directed edge.
The documentation for this class was generated from the following file: