egttools.plotting.plot_network_state

plot_network_state(G, population, strategy_names=None, strategy_colors=None, ax=None, layout=None, node_size=80, edge_color='#aaaaaa', edge_alpha=0.5, legend=True)[source]

Draw a network snapshot with nodes coloured by their current strategy.

Parameters:
  • G (networkx.Graph (or any object with an .adjacency() method)) – The network topology.

  • population (sequence of int) – Strategy index of each node (same order as list(G.nodes())).

  • strategy_names (sequence of str, optional) – Labels for each strategy. Defaults to ["Strategy 0", ...].

  • strategy_colors (sequence, optional) – Colours for each strategy.

  • ax (matplotlib.axes.Axes, optional) – Existing axes to draw on.

  • layout (dict, optional) – {node: (x, y)} positions. Computed via NetworkX spring layout if omitted.

  • node_size (int)

  • edge_color (str)

  • edge_alpha (float)

  • legend (bool) – Whether to draw a strategy legend.

Return type:

matplotlib.axes.Axes