37 lines
976 B
C
37 lines
976 B
C
#ifndef INCLUDED_C_DIRECTEDEDGE_H
|
|
#define INCLUDED_C_DIRECTEDEDGE_H
|
|
|
|
#ifndef INCLUDED_C_TYPES_H
|
|
#include <c_Types.h>
|
|
#endif /*INCLUDED_C_TYPES_H*/
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
|
/* */
|
|
|
|
typedef struct {
|
|
c_size_t from; /* The source vertex index */
|
|
c_size_t to; /* The destination vertex index */
|
|
double weight; /* The numerical edge weight */
|
|
} c_DirectedEdge_t;
|
|
|
|
#define C_DIRECTED_EDGE_SENTINEL ((c_size_t)(-1))
|
|
|
|
/* Inline helper methods for c_DirectedEdge_t */
|
|
C_STATIC_FORCE_INLINE
|
|
c_size_t c_DirectedEdge_From(const c_DirectedEdge_t* edge) {
|
|
return edge ? edge->from : 0;
|
|
}
|
|
|
|
C_STATIC_FORCE_INLINE
|
|
c_size_t c_DirectedEdge_To(const c_DirectedEdge_t* edge) {
|
|
return edge ? edge->to : 0;
|
|
}
|
|
|
|
C_STATIC_FORCE_INLINE
|
|
double c_DirectedEdge_Weight(const c_DirectedEdge_t* edge) {
|
|
return edge ? edge->weight : 0.0;
|
|
}
|
|
|
|
#endif /*INCLUDED_C_DIRECTEDEDGE_H*/
|