private void connectForest() {
		List forest = new ArrayList();
		Stack stack = new Stack();
		NodeList tree;
		graph.nodes.resetFlags();
		for (int i = 0; i < graph.nodes.size(); i++) {
			Node neighbor, n = graph.nodes.getNode(i);
			if (n.flag)
				continue;
			tree = new NodeList();
			stack.push(n);
			while (!stack.isEmpty()) {
				n = (Node) stack.pop();
				n.flag = true;
				tree.add(n);
				for (int s = 0; s < n.incoming.size(); s++) {
					neighbor = n.incoming.getEdge(s).source;
					if (!neighbor.flag)
						stack.push(neighbor);
				}
				for (int s = 0; s < n.outgoing.size(); s++) {
					neighbor = n.outgoing.getEdge(s).target;
					if (!neighbor.flag)
						stack.push(neighbor);
				}
			}
			forest.add(tree);
		}

		if (forest.size() > 1) {
			// connect the forest
			graph.forestRoot = new Node("the forest root"); //$NON-NLS-1$
			graph.nodes.add(graph.forestRoot);
			for (int i = 0; i < forest.size(); i++) {
				tree = (NodeList) forest.get(i);
				graph.edges.add(new Edge(graph.forestRoot, tree.getNode(0), 0,
						0));
			}
		}
	}