diff --git a/Graph.py b/Graph.py index 5463991..fd0655d 100644 --- a/Graph.py +++ b/Graph.py @@ -73,14 +73,15 @@ def load_from_json (self, jsonGraphArray): if ('vertex' in json_object): vertexDict = json_object['vertex'] vertexId = vertexDict['id'] - vertex = Vertex(vertexId) - if ('timestamp' in vertexDict): - vertex.timestamp = int(vertexDict['timestamp']) - if ('attributes' in vertexDict): - json_attrs = vertexDict['attributes'] - for key,value in json_attrs.iteritems(): - vertex.add_attribute(key, value) - self.vertices[vertexId] = vertex + if (vertexId not in self.vertices): # in case fused graph with duplicate vertices + vertex = Vertex(vertexId) + if ('timestamp' in vertexDict): + vertex.timestamp = int(vertexDict['timestamp']) + if ('attributes' in vertexDict): + json_attrs = vertexDict['attributes'] + for key,value in json_attrs.iteritems(): + vertex.add_attribute(key, value) + self.vertices[vertexId] = vertex if ('edge' in json_object): edgeDict = json_object['edge'] edgeId = edgeDict['id'] @@ -184,7 +185,7 @@ def write_to_file(self, outputFile): firstOne = False else: outputFile.write(',') - outputFile.write('"' + key + '"="' + value + '"') + outputFile.write('"' + key + '": "' + value + '"') outputFile.write('},\n') outputFile.write(' "timestamp": "' + str(self.timestamp) + '"}}') @@ -227,7 +228,7 @@ def write_to_file(self, outputFile): firstOne = False else: outputFile.write(',') - outputFile.write('"' + key + '"="' + value + '"') + outputFile.write('"' + key + '": "' + value + '"') outputFile.write('},\n') if self.directed: outputFile.write(' "directed": "true",\n') diff --git a/Subdue.py b/Subdue.py index b9a23ae..4b4923d 100644 --- a/Subdue.py +++ b/Subdue.py @@ -34,6 +34,7 @@ def DiscoverPatterns(parameters, graph): pattern.print_pattern(' ') discoveredPatternList = [] while ((patternCount < parameters.limit) and parentPatternList): + print str(parameters.limit - patternCount) + " patterns left" childPatternList = [] # extend each pattern in parent list (***** todo: in parallel) while (parentPatternList):