Condition for deadlock: Cycle in resource allocation graph. (assuming single instance of every resource)
But it isn't required that only all the process in cycle are in deadlock. Process outside this cycle can be in deadlock.
Example:
A, B and C are process, X and Y are resource. A has X, B wants it. B has Y and A wants it. C wants X. All process are in deadlock.