kahn-algorithm