Skip to content

Commit

Permalink
Updated how Cells and Populations get neighbors. Prevents Cells from …
Browse files Browse the repository at this point in the history
…needing to know about nodes.

Updated to version 1.0.12
  • Loading branch information
Brian Connelly committed Sep 6, 2011
1 parent 08e3964 commit 9dd412f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/runseeds.py
Expand Up @@ -9,7 +9,7 @@
"""

__author__ = "Brian Connelly <bdc@msu.edu>"
__version__ = "1.0.11"
__version__ = "1.0.12"
__credits__ = "Brian Connelly"

import seeds as S
Expand Down
2 changes: 1 addition & 1 deletion seeds/Cell.py
Expand Up @@ -123,7 +123,7 @@ def remove_neighbor(self, neighbor):

def get_neighbors(self):
"""Get a list of neighboring cells"""
return [self.population.topology.graph.node[n]['cell'] for n in self.population.topology.get_neighbors(self.node)]
return self.population.get_neighbors(self)

def update_neighbors(self):
"""Update the list of neighboring cells"""
Expand Down
4 changes: 4 additions & 0 deletions seeds/Population.py
Expand Up @@ -304,3 +304,7 @@ def disconnect_cells(self, src, dest):
def get_cell_id(self):
"""Return a unique ID to be used for a Cell"""
return self.cell_id_manager.next()

def get_neighbors(self, cell):
"""Return a list of the neighbors for the given cell"""
return [self.topology.graph.node[n]['cell'] for n in self.topology.get_neighbors(cell.node)]
1 change: 0 additions & 1 deletion seeds/Resource.py
Expand Up @@ -264,4 +264,3 @@ def resourcetpye_distance(self, src, dest):
"""

return self.topology.node_distance(src.id, dest.id)

2 changes: 1 addition & 1 deletion seeds/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
VERSION = (1, 0, 11)
VERSION = (1, 0, 12)
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__license__ = "Apache Version 2"
__download_url__ = "https://github.com/downloads/briandconnelly/seeds/seeds-%s.tar.gz" % (__version__)
Expand Down

0 comments on commit 9dd412f

Please sign in to comment.