Function addEdge

Synopsis

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

uint32_t addEdge(uint32_t srcNode, uint32_t dstNode)

Description

Add an edge

Source

Lines 86-105 in Source/Falcor/Utils/Algorithm/DirectedGraph.h.

uint32_t addEdge(uint32_t srcNode, uint32_t dstNode)
{
    if (mNodes.find(srcNode) == mNodes.end())
    {
        logWarning("Can't add an edge to DirectGraph, src node ID doesn't exist");
        return kInvalidID;
    }
    if (mNodes.find(dstNode) == mNodes.end())
    {
        logWarning("Can't add an edge to DirectGraph, src node ID doesn't exist");
        return kInvalidID;
    }
    mNodes[srcNode].mOutgoingEdges.push_back(mCurrentEdgeId);
    mNodes[dstNode].mIncomingEdges.push_back(mCurrentEdgeId);
    mEdges[mCurrentEdgeId] = (Edge(srcNode, dstNode));
    return mCurrentEdgeId++;
}





Add Discussion as Guest

Log in