Use the algorithm described by D. Knuth in 'The Art of %
%Computer Programming', Vol.1 3rd ed. p.265. The detection %
%of cycles is described in exercise 23 p.271 and p.548.
Gobo Eiffel Structure Library
Copyright (c) 2001-2003, Eric Bezault and others
Eiffel Forum License v2 (see forum.txt)
$Date: 2005/07/13 17:52:52 $
$Revision: 1.13 $
-- Create a new topological sorter.
-- Set initial capacity to nb.
-- Create a new topological sorter.
-- Set initial capacity to a default value.
-- Items involved in a cycle if any
-- (Note: the items in cycle are stored in reverse order
-- and the first item is repeated at the end of the list.)
-- Equality tester to compare items to be sorted;
-- A void equality tester means that = will be
-- used as comparison criterion.
-- Index of v in the list of items to be sorted;
-- Return 'count + 1' if v is not in the list yet
-- Sorted items
-- Number of items to be sorted
-- Can set_equality_tester be called with a_tester
-- as argument in current state of the sorter?
-- Is v included in the list of items to be sorted?
-- Specify that item u should appear
-- before item v in the sorted list.
-- Insert u and v in the list of items
-- to be sorted if not already done.
-- Set equality_tester to a_tester.
-- A void equality tester means that =
-- will be used as comparison criterion.
Topological sorters