Added function to graft an output node from the input node