fix indents from ipynb to py
This commit is contained in:
parent
15efd64c3e
commit
74d59ecc2e
20
main.py
Normal file → Executable file
20
main.py
Normal file → Executable file
@ -270,22 +270,22 @@ plt.show()
|
|||||||
# |%%--%%| <mgJWQ0bqG1|64kmoHYvCD>
|
# |%%--%%| <mgJWQ0bqG1|64kmoHYvCD>
|
||||||
|
|
||||||
# Connectivity measure
|
# Connectivity measure
|
||||||
def check_food_source_connectivity(food_sources, paths): #food_sources = nodes.is_nest, paths=result from BFS
|
def check_food_source_connectivity(food_sources, paths): #food_sources = nodes.is_nest, paths=result from BFS
|
||||||
connected_food_sources = set()
|
connected_food_sources = set()
|
||||||
|
|
||||||
for source in food_sources:
|
for source in food_sources:
|
||||||
if source in paths:
|
if source in paths:
|
||||||
connected_food_sources.add(source)
|
connected_food_sources.add(source)
|
||||||
|
|
||||||
connectivity = len(connected_food_sources)
|
connectivity = len(connected_food_sources)
|
||||||
|
|
||||||
|
|
||||||
return connectivity
|
return connectivity
|
||||||
|
|
||||||
|
|
||||||
# Calculate connectivity through BFS
|
# Calculate connectivity through BFS
|
||||||
|
|
||||||
current_paths = bfs(self.grid, self.grid.fields["nests"], 0.000001)
|
current_paths = bfs(self.grid, self.grid.fields["nests"], 0.000001)
|
||||||
|
|
||||||
|
|
||||||
# |%%--%%| <64kmoHYvCD|JEzmDy4wuX>
|
# |%%--%%| <64kmoHYvCD|JEzmDy4wuX>
|
||||||
@ -305,5 +305,3 @@ plt.show()
|
|||||||
|
|
||||||
|
|
||||||
# |%%--%%| <r0xVXEqlAh|6K80EwwmVN>
|
# |%%--%%| <r0xVXEqlAh|6K80EwwmVN>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user