Skip to content

Commit

Permalink
[Street Network] Show graph in verbose mode only
Browse files Browse the repository at this point in the history
  • Loading branch information
argenos committed Dec 1, 2017
1 parent f3fc1b0 commit d9f5619
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions factory/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def add_streets(self):
dist = ((loc1['x']-loc2['x'])**2 + (loc2['y']-loc2['y'])**2)**0.5
self.G.edges[edge]['dist'] = dist * uniform(1.0, 2.0)

def draw(self, filename=None):
def draw(self, filename=None, verbose=False):
nx.draw(self.F, self.pos, font_size=11, node_size=500,
with_labels=True,
node_color='w')
Expand All @@ -72,7 +72,8 @@ def draw(self, filename=None):
node_shape='s', node_size=800)
if filename:
plt.savefig("scenarios/%s-scenario.png" % filename)
plt.show()
if verbose:
plt.show()

def export(self):
data = nx.node_link_data(self.G)
Expand Down
2 changes: 1 addition & 1 deletion scenario_generator
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def main(filename="random", verbose=False):

print("\nCreating street network...")
streets.add_streets()
streets.draw(filename)
streets.draw(filename, verbose)

export_json(dest, scenario=scenario_params, customers=customer_list,
orders=orders_list,
Expand Down

0 comments on commit d9f5619

Please sign in to comment.