20 #ifndef __CXXGRAPH_EDGE_H__
21 #define __CXXGRAPH_EDGE_H__
28 #include "Node/Node.hpp"
36 std::ostream &operator<<(std::ostream &o,
const Edge<T> &edge);
41 unsigned long long id = 0;
42 std::pair<const Node<T> *,
const Node<T> *> nodePair;
46 Edge(
const unsigned long long id,
const std::pair<
const Node<T> *,
const Node<T> *> &nodepair);
47 virtual ~
Edge() =
default;
48 const unsigned long long &getId()
const;
49 const std::pair<const Node<T> *,
const Node<T> *> &getNodePair()
const;
50 virtual const std::optional<bool> isDirected()
const;
51 virtual const std::optional<bool> isWeighted()
const;
53 virtual bool operator==(
const Edge<T> &b)
const;
54 bool operator<(
const Edge<T> &b)
const;
58 friend std::ostream &operator<<<>(std::ostream &os,
const Edge<T> &edge);
68 Edge<T>::Edge(
const unsigned long long id,
const std::pair<
const Node<T> *,
const Node<T> *> &nodepair) : nodePair(nodepair)
74 const unsigned long long &Edge<T>::getId()
const
80 const std::pair<const Node<T> *,
const Node<T> *> &Edge<T>::getNodePair()
const
86 const std::optional<bool> Edge<T>::isDirected()
const
92 const std::optional<bool> Edge<T>::isWeighted()
const
98 bool Edge<T>::operator==(
const Edge<T> &b)
const
100 return (this->
id == b.id && this->nodePair == b.nodePair);
103 template <
typename T>
104 bool Edge<T>::operator<(
const Edge<T> &b)
const
106 return (this->
id < b.id);
109 template <
typename T>
110 std::ostream &operator<<(std::ostream &os,
const Edge<T> &edge)
112 os <<
"((Node: " << edge.nodePair.first->getId() <<
")) ?----- |Edge: " << edge.id <<
"|-----? ((Node: " << edge.nodePair.second->getId() <<
"))";