Home▸Articles▸Cybersecurity

AI Attack Path Planner 2D: Q-Learning on a Network Graph

Understanding how reinforcement learning agents navigate network graphs to find optimal paths in cybersecurity scenarios.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What is Q-Learning?

Q-learning is a model-free reinforcement learning technique that aims to learn a policy, which tells an agent what action to take under what circumstances. It does this by estimating the expected utility of each action in a given state and updating these estimates based on the rewards received from taking actions.

In the context of cybersecurity, Q-learning can be used to train AI agents to find optimal attack paths within network graphs, balancing risk against potential gains.

The Bellman Equation

The Bellman equation is a key component in reinforcement learning that defines how the expected utility of an action in a state can be expressed as a function of the utilities of subsequent states. It provides a way to recursively calculate the optimal policy for decision-making processes.

In Q-learning, the Bellman equation helps update the Q-values (expected utility) for each action-state pair based on the immediate reward and the maximum expected future rewards.

live demo · related simulation● LIVE

Application in Cybersecurity

Cybersecurity involves protecting networks from unauthorized access and attacks. An AI-driven attack path planner can use Q-learning to explore different paths within a network graph, learning which routes are most likely to succeed given the current state of defenses.

By adjusting parameters like the defender's vigilance level, the agent must weigh the risk of being detected against the potential benefits of an attack.

Key Parameters and Their Impact

The learning rate determines how much new information overrides old information in updating Q-values. A higher learning rate means faster convergence to optimal policies but can also lead to instability.

Exploration rate controls the balance between exploring new paths (actions) versus exploiting known good ones. Too high, and the agent may miss out on better strategies; too low, and it might get stuck in suboptimal solutions.

Frequently asked questions

How does Q-learning differ from other reinforcement learning methods?

Q-learning is model-free, meaning it doesn't require knowledge of the underlying environment dynamics. It directly learns a policy through trial and error by updating action-value functions based on observed rewards.

Can Q-learning be used for defense as well as attack in cybersecurity?

Yes, Q-learning can also be applied to defensive strategies where an agent learns optimal policies for defending against attacks. It helps in identifying the most vulnerable points and formulating countermeasures.

What are some real-world applications of Q-learning in cybersecurity?

Q-learning is used in intrusion detection systems, network security optimization, and automated response strategies to enhance cyber resilience by learning from past incidents and adapting to new threats.

How does the defender's vigilance slider affect the AI agent’s behavior?

The defender's vigilance slider influences how cautious the AI agent is about being detected. Higher vigilance levels make the agent more conservative, potentially leading it to choose safer but less rewarding paths.

Try it live

Everything above runs in your browser — open AI Attack Path Planner 2D: Q-Learning on a Network Graph and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open AI Attack Path Planner 2D: Q-Learning on a Network Graph simulation

What did you find?

Add reproduction steps (optional)