private Stack<Node> pushStackAccordingNodeId(String nodeID) {

		Node tempNode = nodes[Integer.parseInt(nodeID) - 1];

		String nodeId = tempNode.getNodeId();

		while (tempNode.isVisited()) {
			if (tempNode.getNextNode() != null) {
				tempNode = tempNode.getNextNode();
			} else {
				break;
			}
		}
		while (!tempNode.isVisited()) {
			stackNodes.push(tempNode);
			makeVisitedNodeTrue(nodeId);
			if (tempNode.getNextNode() != null) {
				tempNode = tempNode.getNextNode();
			} else {
				break;
			}

			while (tempNode.isVisited()) {
				if (tempNode.getNextNode() != null) {
					tempNode = tempNode.getNextNode();
				} else {
					break;
				}
			}
			nodeId = tempNode.getNodeId();
			pushStackAccordingNodeId(nodeId);
		}
		return stackNodes;

	}