From b7ae6b143e65f782abd092e2af79b8d5f3157b4a Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 22 Jun 2018 15:56:17 +0000 Subject: [PATCH] Impact analysis performance enhancement: much better (and faster) processing of graphs containing loops. SVN:trunk[5902] --- core/relationgraph.class.inc.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/core/relationgraph.class.inc.php b/core/relationgraph.class.inc.php index 504e2107f..3e3521767 100644 --- a/core/relationgraph.class.inc.php +++ b/core/relationgraph.class.inc.php @@ -433,15 +433,19 @@ class RelationGraph extends SimpleGraph } elseif ($oObjectNode->GetProperty('developped', false)) { - // No need to execute the queries again... just dig into the nodes down/up to iMaxDepth - // - $aRelatedEdges = $bDown ? $oObjectNode->GetOutgoingEdges() : $oObjectNode->GetIncomingEdges(); - foreach ($aRelatedEdges as $oRelatedEdge) - { - $oRelatedNode = $bDown ? $oRelatedEdge->GetSinkNode() : $oRelatedEdge->GetSourceNode(); - // Recurse (decrement the depth) - $this->AddRelatedObjects($sRelCode, $bDown, $oRelatedNode, $iMaxDepth - 1, $bEnableRedundancy); - } + // No need to explore the underlying graph at all. We can stop here since the node has already been developped. + // Otherwise in case of "loops" in the graph we would recurse up to the max depth limit + // without producing any difference in the resulting graph... but potentially taking a LOOOONG time. + return; + + // Former code was + //$aRelatedEdges = $bDown ? $oObjectNode->GetOutgoingEdges() : $oObjectNode->GetIncomingEdges(); + //foreach ($aRelatedEdges as $oRelatedEdge) + //{ + // $oRelatedNode = $bDown ? $oRelatedEdge->GetSinkNode() : $oRelatedEdge->GetSourceNode(); + // // Recurse (decrement the depth) + // $this->AddRelatedObjects($sRelCode, $bDown, $oRelatedNode, $iMaxDepth - 1, $bEnableRedundancy); + //} } else {