yawning_titan.envs.generic.helpers.graph2plot#

Functions

repeat_check

Checks if a node already exists by comparing the nodes colour and description with nodes already in the legend.

Classes

CustomEnvGraph

A network graph rendering environment for Open AI Gym use.

yawning_titan.envs.generic.helpers.graph2plot.repeat_check(node, legend_list)[source]#

Checks if a node already exists by comparing the nodes colour and description with nodes already in the legend.

Parameters:
  • node – A node dict.

  • legend_list – The legend list.

Returns:

True if is already exists, otherwise False.

class yawning_titan.envs.generic.helpers.graph2plot.CustomEnvGraph(title=None)[source]#

A network graph rendering environment for Open AI Gym use.

Initialise the CustomEnvGraph that is used to visualise and render node environments.

Parameters:

title – The name of the plot

__init__(title=None)[source]#

Initialise the CustomEnvGraph that is used to visualise and render node environments.

Parameters:

title – The name of the plot

render(current_step, g, attacked_nodes, current_time_step_reward, made_safe_nodes, show_only_blue_view=False, target_node=None, show_node_names=False)[source]#

Render the current network into an axis.

Parameters:
  • current_step – the current step in the environment (int)

  • g – a networkx object that stores the current connectivity (networkx graph)

  • pos – a dictionary that contains the points and their positions

  • compromised_nodes – a dictionary of all the compromised nodes and a boolean value if blue can see the intrusion or not

  • uncompromised_nodes – a list of all the uncompromised nodes

  • attacked_nodes – a list of the nodes where an attack is happening (infected node, target node)

  • current_time_step_reward – the current total reward

  • red_previous_node – CURRENTLY NOT USED

  • vulnerability_dict – A dictionary that stores the vulnerability of the nodes

  • made_safe_nodes – a list of nodes that the blue agent has made safe this turn

  • title – The title for the render

  • special_nodes – A dictionary containing dictionaries of: nodes, node descriptions and colours for the nodes

  • entrance_nodes – Nodes that serve as a gateway for the red agent to be able to access the network

  • show_only_blue_view – If true only shows what the blue agent can see

  • show_node_names – Show the names of nodes

close()[source]#

Close all handles to external renderers.