Activity Diagrams Unified Modeling Language (UML) (original) (raw)

Last Updated : 21 Jan, 2026

Activity diagrams are an essential part of the Unified Modeling Language (UML) that help visualize workflows, processes, or activities within a system. They depict how different actions are connected and how a system moves from one state to another.

Activity Diagram

Activity diagrams show the steps involved in how a system works, helping us understand the flow of control. They display the order in which activities happen and whether they occur one after the other (sequential) or at the same time (concurrent). These diagrams help explain what triggers certain actions or events in a system.

Use of Activity Diagram

Activity diagrams are useful in several scenarios, especially when you need to visually represent the flow of processes or behaviors in a system. Here are key situations when you should use an activity diagram:

  1. **Modeling Workflows or Processes: When you need to map out a business process, workflow, or the steps involved in a use case, activity diagrams help visualize the flow of activities.
  2. **Concurrent or Parallel Processing: If your system or process involves activities happening simultaneously, an activity diagram can clearly show the parallel flow of tasks.
  3. **Understanding the Dynamic Behavior: When it’s essential to depict how a system changes over time and moves between different states based on events or conditions, activity diagrams are effective.
  4. **Clarifying Complex Logic: Use an activity diagram to simplify complex decision-making processes with branching paths and different outcomes.
  5. **System Design and Analysis: During the design phase of a software system, activity diagrams help developers and stakeholders understand how different parts of the system interact dynamically.
  6. **Describing Use Cases: They are useful for illustrating the flow of control within a use case, showing how various components of the system interact during its execution.

Activity Diagram Notations

Activity-Diagram-Notations

1. Initial State

The starting state before an activity takes place is depicted using the initial state.

initial-state

A process can have only one initial state unless we are depicting nested activities. We use a black filled circle to depict the initial state of a system. For objects, this is the state when they are instantiated. The Initial State from the UML Activity Diagram marks the entry point and the initial Activity State.

**For example:

Here the initial state of the system before the application is opened.

Initial-State-symbol-being-used-(1)

2. Action or Activity State

An activity represents execution of an action on objects or by objects. We represent an activity using a rectangle with rounded corners. Basically any action or event that takes place is represented using an activity.

activity-state**For example:

Consider the previous example of opening an application, opening the application is an activity state in the activity diagram.

Activity-State-symbol-being-used

3. Action Flow or Control flows

Action flows or Control flows are also referred to as paths and edges. They are used to show the transition from one activity state to another activity state.

control-flow

An activity state can have multiple incoming and outgoing action flows. We use a line with an arrow head to depict a Control Flow. If there is a constraint to be adhered to while making the transition it is mentioned on the arrow.

**For example:

Here both the states transit into one final state using action flow symbols i.e. arrows.

Using-Action-Flows-for-Transitions

4. Decision node and Branching

When we need to make a decision before deciding the flow of control, we use the decision node. The outgoing arrows from the decision node can be labelled with conditions or guard expressions. It always includes two or more output arrows.

decision-node

**For example:

We apply the conditions on input number to display the result :

An-Activity-Diagram-using-Decision-Node**5. Guard

A Guard refers to a statement written next to a decision node on an arrow sometimes within square brackets.

guard

The statement must be true for the control to shift along a particular direction. Guards help us know the constraints and conditions which determine the flow of a process.

6. Fork

Fork nodes are used to support concurrent activities. When we use a fork node when both the activities get executed concurrently i.e. no decision is made before splitting the activity into two parts. Both parts need to be executed in case of a fork statement. We use a rounded solid rectangular bar to represent a Fork notation with incoming arrow from the parent activity state and outgoing arrows towards the newly created activities.

fork

**For example:

In the example below, the activity of making coffee can be split into two concurrent activities and hence we use the fork notation.

A-Diagram-using-Fork-Notation7. Join

Join nodes are used to support concurrent activities converging into one. For join notations we have two or more incoming edges and one outgoing edge.

join

**For example:

When both activities i.e. steaming the milk and adding coffee get completed, we converge them into one final activity.

A-Diagram-using-Join-Notation

8. Merge or Merge Event

Scenarios arise when activities which are not being executed concurrently have to be merged. We use the merge notation for such scenarios. We can merge two or more activities into one if the control proceeds onto the next activity irrespective of the path chosen.

merge

**For example:

In the diagram below: we can't have both sides executing concurrently, but they finally merge into one. A number can't be both odd and even at the same time.

An-Activity-Diagram-using-Merge-Notation-(1)

9. Swimlanes

We use Swimlanes for grouping related activities in one column. Swimlanes group related activities into one column or one row. Swimlanes can be vertical and horizontal. Swimlanes are used to add modularity to the activity diagram. It is not mandatory to use swimlanes. They usually give more clarity to the activity diagram. It's similar to creating a function in a program. It's not mandatory to do so, but, it is a recommended practice.

swimlane

We use a rectangular column to represent a swimlane as shown in the figure above.

**For example:

Here different set of activities are executed based on if the number is odd or even. These activities are grouped into a swimlane.

An-Activity-Diagram-making-use-of-Swimlanes

10. Time Event

This refers to an event that stops the flow for a time; an hourglass depicts it. We can have a scenario where an event takes some time to completed.

time-event

**For example:

Let us assume that the processing of an image takes a lot of time. Then it can be represented as shown below.

An-Activity-Diagram-using-Time-Event-Notation

11. Final State or End State

The state which the system reaches when a particular process or activity ends is known as a Final State or End State. We use a filled circle within a circle notation to represent the final state in a state machine diagram. A system or a process can have multiple final states.

final-state

Draw an Activity Diagram in UML

Steps-to-Draw-an-Activity-Diagram

Below are the steps of how to draw the Activity Diagram in UML:

**Step 1. Identify the Initial State and Final States:

**Step 2. Identify the Intermediate Activities Needed:

**Step 3. Identify the Conditions or Constraints:

**Step 4. Draw the Diagram with Appropriate Notations:

Now, represent the identified states, activities, and conditions visually using the appropriate symbols and notations in an activity diagram. This diagram serves as a visual map of your process, showing the flow from one state to another.

Activity Diagram Example

Here’s an example of an activity diagram that shows the process of making an online purchase:

**Steps:

Differences between an Activity diagram and a Flowchart

An activity diagram is very similar to a flowchart. So let us understand if activity diagrams or flowcharts are any different.

Flow Chart

An algorithm is like a set of clear instructions to solve a problem, and a flowchart is a picture that shows those instructions.

**Example:

A manufacturer uses a flow chart to explain and illustrate how a particular product is manufactured.

Flowchart Activity Diagram
Represents the step-by-step flow of a process or algorithm Represents the flow of activities and actions in a system
Used mainly for procedural or algorithmic logic Used to model workflows and business processes
Focuses on control flow using symbols like start, process, decision Focuses on activities, decisions, parallel flows, and transitions
Simple and easy to understand More expressive and detailed than flowcharts
Commonly used in programming and problem-solving Commonly used in UML for system and process modeling
Does not support concurrency well Supports parallel and concurrent activities

Do we need to use both the diagrams and the textual documentation?

Let's understand this with the help of an example: