Class DirectedGraphLoopDetector

Synopsis

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

class DirectedGraphLoopDetector

Description

No description yet.

Methods

hasLoop

Source

Lines 148-164 in Source/Falcor/Utils/Algorithm/DirectedGraphTraversal.h.

class DirectedGraphLoopDetector
{
public:
    static bool hasLoop(const DirectedGraph::SharedPtr pGraph, uint32_t rootNode)
    {
        DirectedGraphDfsTraversal dfs(pGraph, rootNode);
        // Skip the first node since it's the root
        uint32_t n = dfs.traverse();
        while (n != DirectedGraph::kInvalidID)
        {
            n = dfs.traverse();
            if (n == rootNode) return true;
        }
        return false;
    }
};





Add Discussion as Guest

Log in