Function removeNode


#include <Source/Falcor/Utils/Algorithm/DirectedGraph.h>

std::unordered_set< uint32_t > removeNode(uint32_t id)


Remove a node from the graph. This function will also remove all the incoming and outgoing edges associated with the node

A list of edges that were removed


Lines 62-82 in Source/Falcor/Utils/Algorithm/DirectedGraph.h.

std::unordered_set<uint32_t> removeNode(uint32_t id)
    if (mNodes.find(id) == mNodes.end())
        logWarning("Can't remove node from DirectGraph, node ID doesn't exist");
        return {};
    std::unordered_set<uint32_t> removedEdges;
    // Find all the edges we need to remove
    for (auto& edgeId : mNodes[id].mIncomingEdges) findEdgesToRemove<false>(mNodes[mEdges[edgeId].mSrc].mOutgoingEdges, id, removedEdges);
    for (auto& edgeId : mNodes[id].mOutgoingEdges) findEdgesToRemove<true>(mNodes[mEdges[edgeId].mDst].mIncomingEdges, id, removedEdges);
    // Remove them
    for (auto& edgeId : removedEdges) removeEdge(edgeId);
    // Remove the index from the map

    return removedEdges;

Add Discussion as Guest

Log in