agentlab.experiments.view_dep_graph
Dirty script to visualize the dependency graph of a benchmark, e.g. webarena, vsisualwebarena, etc. You may have to detust it to make it work for you.
Functions
|
|
Compress chains in a directed graph by merging nodes that have single parent and single child. |
|
|
Compress chains of sequential numbers in a dependency dictionary. |
|
|
|
Plot components in a grid layout. |
|
Plot a single graph component on the given matplotlib axis. |
- agentlab.experiments.view_dep_graph.clean_dict(dependency_dict: dict[str, list[str]]) dict[str, list[str]]
- agentlab.experiments.view_dep_graph.compress_chains(G)
Compress chains in a directed graph by merging nodes that have single parent and single child.
- Parameters:
G – NetworkX directed graph
- Returns:
NetworkX directed graph with compressed chains
- agentlab.experiments.view_dep_graph.compress_sequential_chains(dep_dict: dict[str, list[str]]) dict[str, list[str]]
Compress chains of sequential numbers in a dependency dictionary. Returns a new dictionary with compressed chains using range notation.
- Parameters:
dep_dict – Dictionary mapping string numbers to list of string number dependencies
- Returns:
Dictionary with compressed chains using range notation
- agentlab.experiments.view_dep_graph.dict_to_networkx(dependency_dict: dict[str, list[str]]) DiGraph
- agentlab.experiments.view_dep_graph.plot_components_grid(components, max_cols=4, node_color='lightblue', node_size=2000, font_size=10)
Plot components in a grid layout.
- Parameters:
components – List of NetworkX graphs, one per component
max_cols – Maximum number of columns in the grid
node_color – Color for the nodes
node_size – Size of the nodes
font_size – Size of the node labels
- Returns:
matplotlib figure
- agentlab.experiments.view_dep_graph.plot_graph(G, ax, title=None, node_color='lightblue', node_size=40, font_size=8)
Plot a single graph component on the given matplotlib axis.
- Parameters:
G – NetworkX graph (should be a single connected component)
ax – Matplotlib axis to plot on
title – Optional title for the subplot
node_color – Color for the nodes
node_size – Size of the nodes
font_size – Size of the node labels