human
Number of ways to reach at starting node after travelling through exactly K edges in a complete graph | Function to find number of ways to reach from node 1 to 1 again , after moving exactly K edges.
Initialize a dp [ ] array , where dp [ i ] stores number of ways to reach at a i node.
Base Case.
Iterate for the number of edges moved.
Sum will store number of ways to reach all the nodes.
Iterate for every possible state for the current step.
Update the value of the dp array after travelling each edge.
Print dp [ 0 ] as the answer.
Driver Code.
Given Input.
Function Call"
How can the above be solved in Python?
 Can you provide a code to number of ways to reach at starting node after travelling through exactly K edges in a complete graph and the other steps required?
assistant
#Here is code to number of ways to reach at starting node after travelling through exactly K edges in a complete graph and the other steps required.
 def numberOfWays ( n , k ) :
	dp = [ 0 for i in range ( 1000 ) ]
	dp [ 0 ] = 1
	for i in range ( 1 , k + 1 , 1 ) :
		numWays = 0
		for j in range ( n ) :
			numWays += dp [ j ]
		for j in range ( n ) :
			dp [ j ] = numWays - dp [ j ]
	print ( dp [ 0 ] )
if __name__ == ' _ _ main _ _ ' :
	N = 5
	K = 3
	numberOfWays ( N , K )