#NEWLINE# @ staticmethod #NEWLINE# def treeDepth( treeGraph ) : #NEWLINE# #INDENT# '\n        Find the depth of the given tree. \n        ' #NEWLINE# if ( treeGraph . getNumVertices ( ) == 0 ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# if ( not treeGraph . isTree ( ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Input graph is not a tree' ) #NEWLINE# #UNINDENT# root = GraphUtils . treeRoot ( treeGraph ) #NEWLINE# distances = treeGraph . dijkstrasAlgorithm ( distances ) #NEWLINE# return numpy . max ( distances [ ( distances != float ( 'inf' ) ) ] )