// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" /** Data structure and algorithm to find all cycles in a UObject directed graph **/ struct FFindStronglyConnected { struct NodeInfo { int32 IndexValue; int32 LowIndex; bool InStack; }; TMultiMap AllEdges; TMultiMap Edges; TArray AllObjects; TSet PermanentObjects; TArray TempObjects; TMap NodeIndex; int32 MasterIndex; TArray Stack; TArray> Components; TArray> SimpleCycles; FFindStronglyConnected() : MasterIndex(1) { } /** Find all cycles in the uobject reference graph **/ void FindAllCycles(); void FindSimpleCycleForComponent(TArray& Dest, const TArray& Component); void StrongConnect(UObject* Node); private: bool FindSimpleCycleForComponentInner(TArray& Dest, const TArray& Component, UObject* Node); NodeInfo* StrongConnectInner(UObject* Node); };