The distributed beamforming problem for amplify-and-forward relay networks is studied. Maximizing output SNR (signal-to-noise ratio) for distributed beamforming can be considered as a generalized eigenvector problem (GEP) and the principal eigenvector and its eigenvalue can be derived with a standard closed-form solution. In this paper, four classes of beamforming algorithms are derived based on different design criteria and constraints, including maximizing output SNR subject to a constraint on the total transmitted signal power, minimizing the total transmitted signal power subject to certain level of output SNR, minimizing the relay node number subject to constraints on the total signal power and output SNR, and a robust algorithm to dea...