Let N be a prime near-ring. We show two main results on the commutativity of N: (1) If there exist k, l ∈ ℕ 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]xl for all x, y ∈ N, then N is a commutative ring. (2) If there exist k, l ∈ ℕ 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) 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.