> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.graph_utils.invert_disallowed_to_allowed

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### invert\_disallowed\_to\_allowed

```python theme={null}
invert_disallowed_to_allowed(disallowed_speaker_transitions_dict: dict[str, list[Agent]], agents: list[Agent]) -> dict[str, list[Agent]]
```

Invert the disallowed\_speaker\_transitions\_dict to form the allowed\_speaker\_transitions\_dict.<br />Start with a fully connected allowed\_speaker\_transitions\_dict of all agents. Remove edges from the fully connected allowed\_speaker\_transitions\_dict according to the disallowed\_speaker\_transitions\_dict to form the allowed\_speaker\_transitions\_dict.<br />

<b>Parameters:</b>

| Name                                  | Description                                                                                                                                                                                                                                                      |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `disallowed_speaker_transitions_dict` | A dictionary of keys and list as values.<br /><br />The keys are the names of the agents, and the values are the names of the agents that the key agent cannot transition to.<br /><br />**Type:** dict\[str, list\[[Agent](/docs/api-reference/autogen/Agent)]] |
| `agents`                              | A list of Agents<br /><br />**Type:** list\[[Agent](/docs/api-reference/autogen/Agent)]                                                                                                                                                                          |

<b>Returns:</b>

| Type                                                          | Description                                                                                                                                                                                          |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| dict\[str, list\[[Agent](/docs/api-reference/autogen/Agent)]] | allowed\_speaker\_transitions\_dict: A dictionary of keys and list as values. The keys are the names of the agents, and the values are the names of the agents that the key agent can transition to. |

<br />
