Height of a node

how to find height of a node in graph.

Recursively calculate height of left and right subtrees of a node and assign height to the node as max of the heights of two children plus 1.

maxDepth()
1. If tree is empty then return 0
2. Else
     (a) Get the max depth of left subtree recursively  i.e., 
          call maxDepth( tree->left-subtree)
     (a) Get the max depth of right subtree recursively  i.e., 
          call maxDepth( tree->right-subtree)
     (c) Get the max of max depths of left and right 
          subtrees and add 1 to it for the current node.
         max_depth = max(max dept of left subtree,  
                             max depth of right subtree) 
                             + 1
     (d) Return max_depth

i am not asking for a tree, i am asking for graph. how to calculate height of a node in graph?

We can do this by finding the maximum depth from each node .
And then return the list of nodes with the minimum values .

can you please share me the code?

can you please share me the code?