template<class NodeType, class EdgeType>
slang::netlist::Node class

A class to represent a node in a directed graph.

Public types

using EdgePtrType = std::shared_ptr<EdgeType>
using EdgeListType = std::vector<EdgePtrType>
using iterator = typename EdgeListType::iterator
using const_iterator = typename EdgeListType::const_iterator
using edge_descriptor = EdgeType*

Constructors, destructors, conversion operators

Node() defaulted
~Node() defaulted virtual

Public functions

auto begin() const -> const_iterator
auto end() const -> const_iterator
auto begin() -> iterator
auto end() -> iterator
auto operator=(const Node<NodeType, EdgeType>& node) -> Node<NodeType, EdgeType>&
auto operator=(Node<NodeType, EdgeType>&& node) -> Node<NodeType, EdgeType>& noexcept
auto operator==(const NodeType& N) const -> bool
auto findEdgeFrom(const NodeType& sourceNode) -> iterator
Return an iterator to the edge connecting the source node.
auto findEdgeTo(const NodeType& targetNode) -> iterator
Return an iterator to the edge connecting the target node.
auto addEdge(NodeType& targetNode) -> EdgeType&
auto removeEdge(NodeType& targetNode) -> bool
void clearAllEdges()
Remove all edges to/from this node.
auto getEdgesTo(const NodeType& targetNode, std::vector<EdgeType*>& result) -> bool
auto getInEdges() const -> const EdgeListType&
Return the list of outgoing edges from this node.
auto getOutEdges() const -> const EdgeListType&
auto inDegree() const -> size_t
Return the total number of edges incoming to this node.
auto outDegree() const -> size_t
Return the total number of edges outgoing from this node.

Protected functions

auto isEqualTo(const NodeType& node) const -> bool
auto getDerived() -> NodeType&
auto getDerived() const -> const NodeType&
auto addInEdge(EdgePtrType& edge) -> EdgeType&

Protected variables

EdgeListType inEdges
EdgeListType outEdges

Friends

auto operator==(NodeType const& A, NodeType const& B) -> bool noexcept

Function documentation

template<class NodeType, class EdgeType>
EdgeType& slang::netlist::Node<NodeType, EdgeType>::addEdge(NodeType& targetNode)

Add an edge between this node and a target node, only if it does not already exist. Return a reference to the newly-created edge.

template<class NodeType, class EdgeType>
bool slang::netlist::Node<NodeType, EdgeType>::removeEdge(NodeType& targetNode)

Remove an edge between this node and a target node. Return true if the edge existed and was removed, and false otherwise.

template<class NodeType, class EdgeType>
bool slang::netlist::Node<NodeType, EdgeType>::getEdgesTo(const NodeType& targetNode, std::vector<EdgeType*>& result)

Populate a result vector of edges from this node to the specified target node. Return true if at least one edge was found.

template<class NodeType, class EdgeType>
EdgeType& slang::netlist::Node<NodeType, EdgeType>::addInEdge(EdgePtrType& edge) protected

Add a reference to an incoming edge. This method should only be called as part of adding an output edge.

template<class NodeType, class EdgeType>
bool operator==(NodeType const& A, NodeType const& B) noexcept

Static polymorphism: delegate implementation (via isEqualTo) to the derived class. Add friend operator to resolve ambiguity between operand ordering with C++20.