An activity graph is a variation of a State Machine. In the State Machine, the States represent the performance of Actions or subactivities, while the Transitions are triggered by the completion of the Actions or subactivities. It represents a State Machine of a procedure itself. The entire Activity diagram is attached (through the model) to a Class, such as a Use Case, or to a Package, or to the implementation of an Operation. The purpose of this diagram is to focus on flows driven by the internal processing (as opposed to external events). You should use the Activity diagrams in situations where all or most of the events represent the completion of internally-generated actions (that is, procedural flow of control). You should use the ordinary State diagrams in situations where asynchronous events occur. An Activity diagram is a variant of a State diagram. Organized according to Actions, the Activity diagrams are mainly targeted towards the representation of the internal behavior of a method (the implementation of an Operation) or a Use Case.
Though Activity diagrams are often classified alongside the interaction diagrams, they actually focus on the work performed by a system instead of an object interaction. An Activity diagram captures Actions and displays their results.
A State diagram may also represent this sequencing of steps. However, given the procedural nature of the implementation of the operations – in which most events simply correspond to the end of the preceding activity – it is not necessary to distinguish States, activities, and Events systematically (for example, a State changes and external events have less importance inside the method). It is therefore beneficial to have a simplified representation for directly displaying activities.
The Activity diagram provides a convenient way to describe complex algorithms, parallel operations, and business processes. Together with the Communication and Sequence diagrams, they are used to relate Use Cases.