示例#1
0
 def makeGalWeights(self, wtType=weight.WT_ROOK):
     galInfo = weight.spweight(self.shapeFileName, wtType=type)
     galInfo.fixIslands()
     n = len(galInfo.numneigh)
     sout = []
     sout.append("%d" % n)
     for i in range(n):
         sout.append("%d %d" % (i, galInfo.numneigh[i]))
         sout.append(" ".join(["%d" % id for id in galInfo.neighbors[i]]))
     sout = "\n".join(sout)
     return sout
示例#2
0
 def makeGalWeights(self,wtType=weight.WT_ROOK):
     galInfo = weight.spweight(self.shapeFileName, wtType=type)
     galInfo.fixIslands()
     n = len(galInfo.numneigh)
     sout= []
     sout.append("%d"%n)
     for i in range(n):
         sout.append("%d %d"%(i, galInfo.numneigh[i]))
         sout.append(" ".join(["%d"%id for id in galInfo.neighbors[i]]))
     sout = "\n".join(sout)
     return sout
示例#3
0
 def makeGalWeightsAgg(self, wtType=weight.WT_ROOK):
     galInfo = weight.spweight(self.shapeFileName, wtType=type)
     galInfo.fixIslands()
     csids = range(self.n)
     sout = []
     sout.append("%d" % self.n)
     for i in csids:
         neighs = []
         shapeIds = self.id2Row[i]
         for shape in shapeIds:
             neighs = neighs + galInfo.neighbors[shape]
         neighs = [self.row2Id[neigh] for neigh in neighs]
         unique = MATCH.uniqueList(neighs)
         try:
             unique.remove(i)
         except:
             pass
         unique = map(str, unique)
         sout.append("%d %d" % (i, len(unique)))
         sout.append(" ".join(unique))
     sout = "\n".join(sout)
     return sout
示例#4
0
 def makeGalWeightsAgg(self,wtType=weight.WT_ROOK):
     galInfo = weight.spweight(self.shapeFileName, wtType=type)
     galInfo.fixIslands()
     csids = range(self.n)
     sout= []
     sout.append("%d"%self.n)
     for i in csids:
         neighs = []
         shapeIds = self.id2Row[i]
         for shape in shapeIds:
             neighs = neighs + galInfo.neighbors[shape]
         neighs = [ self.row2Id[neigh] for neigh in neighs ]
         unique = MATCH.uniqueList(neighs) 
         try:
             unique.remove(i)
         except:
             pass
         unique = map(str,unique)
         sout.append("%d %d"%(i, len(unique)))
         sout.append(" ".join(unique))
     sout = "\n".join(sout)
     return sout