def AverageGatewayDegree_metric(bpmn_graph):
gateways_ids = [gateway[<NUM_LIT:0>] for gateway in get_all_gateways(bpmn_graph)]<EOL>all_nodes_degrees = bpmn_graph.diagram_graph.degree()<EOL>gateways_degree_values = [all_nodes_degrees[gateway_id] for gateway_id in gateways_ids]<EOL>return float(sum(gateways_degree_values)) / float(len(gateways_degree_values))<EOL>
Returns the value of the Average Gateway Degree metric
("Average of the number of both incoming and outgoing arcs of the gateway nodes in the process model")
for the BPMNDiagramGraph instance.

:param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.