コード例 #1
0
 def ReadGraphs(self, pathToGraphs):
     os.chdir(pathToGraphs)
     for file in glob.glob('*.gml'):
         print 'Reading file: {0}'.format(file)
         graphName = os.path.splitext(file)[0]
         self.graphs[graphName] = gmlReader.read_gml(file)
         self.featuresByGraph[graphName] = []
コード例 #2
0
 def BuildAllFeatures(self, pathToGraphs):
     os.chdir(pathToGraphs)
     files = glob.glob('*.gml')
     numFiles = len(files)
     for file in files:
         print numFiles
         numFiles -= 1
         print 'Reading file: {0}'.format(file)
         g = gmlReader.read_gml(file)
         print 'Building features for file: {0}'.format(file)
         self.features.append(self.BuildFeatures(g))
         print 'Building labels for file: {0}'.format(file)
         self.labels.append(self.LabelFeature(g))
         gc.collect()
     self.features = np.array(self.features)
     self.labels = np.array(self.labels)