mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-19 09:37:14 +02:00
[core] graph: re-implement getDepth to return the correct value
This commit is contained in:
parent
2024d7ab1c
commit
3ca3a794fe
1 changed files with 6 additions and 1 deletions
|
@ -623,7 +623,12 @@ class Graph(BaseObject):
|
||||||
self.addEdge(*edge)
|
self.addEdge(*edge)
|
||||||
|
|
||||||
def getDepth(self, node):
|
def getDepth(self, node):
|
||||||
return len(self.dfsNodesOnFinish([node]))
|
# TODO: would be better to use bfs instead of recursive function
|
||||||
|
inputEdges = self.getInputEdges(node)
|
||||||
|
if not inputEdges:
|
||||||
|
return 0
|
||||||
|
inputDepths = [e.src.node.depth for e in inputEdges]
|
||||||
|
return min(inputDepths) + 1
|
||||||
|
|
||||||
def _getNodeEdges(self):
|
def _getNodeEdges(self):
|
||||||
nodeEdges = defaultdict(set)
|
nodeEdges = defaultdict(set)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue