Nonequilibrium molecular-dynamics simulations are used to investigate the molecular shape of dendrimers and linear polymers in a melt and under shear. Molecules are modeled at the coarse-grained level using a finitely extensible nonlinear elastic bead-spring model. The shape of dendrimers and linear polymers at equilibrium and undergoing planar Couette flow is analyzed quantitatively and it is related to the shear viscosity. The shape of dendrimers responds differently to the influence of shear compared with linear polymers of equivalent molecular mass. However, in both cases the transition from Newtonian to non-Newtonian viscosity behavior corresponds to significant changes in molecular symmetry. This suggests that a shape analysis could be used to estimate the onset of shear thinning in polymers.