Let N be a prime near-ring. We show two main results on the commutativity of N: (1) If there exist k, l ∈ N such that N admits a generalized derivation D satisfying either D([x,y]) = xk[x,y]xl for all x,y ∈ N or D([x,y]) = -xk[x,y]xI for all x,y ∈ N, then N is a commutative ring. (2) If there exist k, l ∈ N such that N admits a generalized derivation D satisfying either D(x o y) = xk(x o y)xl for all x, y ∈ N or D(x o y) = -xk(x o y)xl for all x, y ∈ N, then N is a commutative ring. Moreover, some interesting relations between the prime graph and zero-divisor graph of N are studied.