save network
This commit is contained in:
5
model.py
5
model.py
@@ -93,6 +93,11 @@ class Model(ap.Model):
|
||||
self.firm_network = ap.Network(self, G_Firm)
|
||||
self.product_network = ap.Network(self, G_bom)
|
||||
|
||||
out_file = open("myfile.json", "w")
|
||||
import json
|
||||
json.dump(nx.adjacency_data(G_Firm), out_file)
|
||||
out_file.close()
|
||||
|
||||
# init product
|
||||
for ag_node, attr in self.product_network.graph.nodes(data=True):
|
||||
product = ProductAgent(self, code=ag_node.label, name=attr['Name'])
|
||||
|
||||
Reference in New Issue
Block a user