//This function checks to see if the passed node leads away from //this node. If so, it returns the connecting edge. If not, //it returns a null pointer. DeBruijnEdge * DeBruijnNode::doesNodeLeadAway(DeBruijnNode * node) const { for (size_t i = 0; i < m_edges.size(); ++i) { DeBruijnEdge * edge = m_edges[i]; if (edge->getStartingNode() == this && edge->getEndingNode() == node) return edge; } return 0; }
bool DeBruijnNode::isNodeConnected(DeBruijnNode * node) const { for (size_t i = 0; i < m_edges.size(); ++i) { DeBruijnEdge * edge = m_edges[i]; if (edge->getStartingNode() == node || edge->getEndingNode() == node) return true; } return false; }
std::vector<DeBruijnEdge *> DeBruijnNode::getEnteringEdges() const { std::vector<DeBruijnEdge *> returnVector; for (size_t i = 0; i < m_edges.size(); ++i) { DeBruijnEdge * edge = m_edges[i]; if (this == edge->getEndingNode()) returnVector.push_back(edge); } return returnVector; }
//If the node has an edge which leads to itself (creating a loop), this function //will return it. Otherwise, it returns 0. DeBruijnEdge * DeBruijnNode::getSelfLoopingEdge() const { for (size_t i = 0; i < m_edges.size(); ++i) { DeBruijnEdge * edge = m_edges[i]; if (edge->getStartingNode() == this && edge->getEndingNode() == this) return edge; } return 0; }