function total = trip_distance ( dist, t )

%% TRIP_DISTANCE computes the total length of a city-to-city trip.
%
  n = length ( t );
%
%  Repeat first city at end of list, to make it a round trip.
%
  t = [ t, t(1) ];

  total = 0.0;
  for i = 1 : n
    total = total + dist ( t(i), t(i+1) );
  end

  return
end
