public LinkedList<TT> sort() throws Poset.Exception
{
//System.out.println("Initial events.source.main:");
//printGreaterLesserOrig(findNode("Context(events.source.main)"));

LinkedList<Node> Q = new LinkedList();
	LinkedList<TT> out = new LinkedList();		// Sorted List

	// Q <- Set of nodes with no incoming edge
	for (Map.Entry<TT,Node> e : map.entrySet()) {
		Node n = e.getValue();
		n.gsort = (LinkedList<Node>)n.greater.clone();
		n.lsort = (LinkedList<Node>)n.less.clone();
		if (n.lsort.size() == 0) {
//System.out.println("Initial Q: " + n.o);
//if ("Context(events.source.main)".equals(n.o.toString())) {
//	printGreaterLesser(n);
//}
			Q.add(n);
		}
	}
	

	while (Q.size() > 0) {
		Node<TT> n = Q.remove();
		out.add(n.o);
//System.out.println("Sort: " + n.o);
//if ("Context(recorder)".equals(n.o.toString()) || "Context(events.source.main)".equals(n.o.toString())) {
//	printGreaterLesser(n);
//	System.out.print("sellVolSum:"); printGreaterLesser(findNode("Context(sellVolSum)"));
//	System.out.print("buyVolSum:"); printGreaterLesser(findNode("Context(buyVolSum)"));
//}
		for (Iterator<Node> ii = n.gsort.iterator(); ii.hasNext(); ) {
			Node m = ii.next();
			ii.remove();
			m.lsort.remove(n);
//System.out.println("   Removing edge: " + m.o + " > " + n.o);
			if (m.lsort.size() == 0) {
				Q.add(m);
//				System.out.println("   Adding node: " + m.o);
//if ("Context(events.source.main)".equals(m.o.toString())) {
//	printGreaterLesser(m);
//}
			}
//if ("Context(buyVolSum)".equals(m.o.toString()))
		}
	}
	
	// If graph has edges then there's an error
	boolean err = false;
	for (Map.Entry<TT,Node> e : map.entrySet()) {
		Node n = e.getValue();
		
		if (n.lsort.size() > 0) {
			err = true;
for (Iterator<Node> ii = n.lsort.iterator(); ii.hasNext(); ) {
	Node m = ii.next();
	System.out.println("Cycle edge: " + n.o + " > " + m.o);
}
		}
		n.gsort = null;
		n.lsort = null;
	}
	if (err) throw new Poset.Exception("Cycle found in DAG");
	return out;
}