// Add all nodes
for layer in layers:
self._add_node(layer.input)
self._add_node(layer.output)
// Add all edges
for layer in layers:
After Change
// node id start with 0
self.node_to_id = {}
self.edge_to_id = {}
self.edge_id_to_input_ids = {}
self.old_edge_ids = {}
self.adj_list = {}
self.reverse_adj_list = {}
// Add all nodes
for layer in layers:
if isinstance(layer.input, list):
for temp_input in layer.input:
self._add_node(temp_input)
else:
self._add_node(layer.input)
self._add_node(layer.output)
// Add all edges
for layer in layers: