class Graph implements Serializable {

	public boolean removeNode(T object) throws NodeNotExistsExeption {
		Node<T> node = findNode(object);
		if (node == null)
			throw new NodeNotExistsExeption(object == null ? "null" : object.toString());

		List<Node<T>> ascendingNodes = getAscendingNodes(node);
		for (Node<T> ascendingNode : ascendingNodes) {
			ArrayList<Edge<T>> outputEdges = ascendingNode.getOutputEdges();
			ArrayList<Node<T>> nodesToRemove = new ArrayList<Node<T>>(
					outputEdges.size());
			for (Edge<T> edge : outputEdges) {
				nodesToRemove.add(edge.getEndNode());
			}
			for (Node<T> node2 : nodesToRemove) {
				ascendingNode.removeEdge(node2);
			}

			nodes.remove(ascendingNode);
			rootNodes.remove(ascendingNode);
		}
		nodes.remove(node);
		rootNodes.remove(node);

		for (Node<T> remainedNode : nodes) {
			if (remainedNode.getInputEdges().isEmpty()
					&& rootNodes.contains(remainedNode) == false)
				rootNodes.add(remainedNode);
		}
		return true;
	}

	public  Graph();

}