function power_rank ( A )

%*****************************************************************************80
%
%% power_rank() uses the power method to seek an eigenvector of a directed graph.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 February 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer A(N,N): the incidence matrix.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'power_rank:\n' );
  fprintf ( 1, '  Given an NxN incidence matrix A,\n' );
  fprintf ( 1, '  compute the transition matrix T,\n' );
  fprintf ( 1, '  Then start with a vector of N values 1/N,\n' );
  fprintf ( 1, '  and repeatedly compute x <= T*x\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  After many steps, compare last three iterates.\n' );
  fprintf ( 1, '  If they are close, we are probably at an eigenvector\n' );
  fprintf ( 1, '  associated with the eigenvalue 1.\n' );

  n = size ( A, 1 );
%
%  Compute the transition matrix.
%
  T = inc_to_transition ( A );
%
%  Set the starting vector.
%
  x = ones ( n, 1 ) / n;
%
%  Carry out many iterations.
%  Normalization is not necessary because T is a transition matrix.
%
  for i = 1 : 100

    x = T * x;

  end
%
%  Compare three successive iterates.
%
  x1 =     x;
  x2 = T * x1;
  x3 = T * x2;

  r8vec3_print ( n, x1, x2, x3, '  x, T*x, T*T*x' );

  return
end
