human
Maximum number of edges to be added to a tree so that it stays a Bipartite graph | To store counts of nodes with two colors.
Increment count of nodes with current color.
Traversing adjacent nodes.
Not recurring for the parent node.
Finds maximum number of edges that can be added without violating Bipartite property ..
Do a DFS to count number of nodes of each color.
Driver code To store counts of nodes with two colors"
Solution in Python:

=====
What is a code to maximum number of edges to be added to a tree so that it stays a Bipartite graph and the other steps required?
assistant
#Here is code to maximum number of edges to be added to a tree so that it stays a Bipartite graph and the other steps required.
 def dfs ( adj , node , parent , color ) :
	count_color [ color ] += 1
	for i in range ( len ( adj [ node ] ) ) :
		if ( adj [ node ] [ i ] != parent ) :
			dfs ( adj , adj [ node ] [ i ] , node , not color )
def findMaxEdges ( adj , n ) :
	dfs ( adj , 1 , 0 , 0 )
	return ( count_color [ 0 ] * count_color [ 1 ] - ( n - 1 ) )
count_color = [ 0 , 0 ]
n = 5
adj = [ [ ] for i in range ( n + 1 ) ]
adj [ 1 ] . append ( 2 )
adj [ 1 ] . append ( 3 )
adj [ 2 ] . append ( 4 )
adj [ 3 ] . append ( 5 )
print ( findMaxEdges ( adj , n ) )