Skip to content

Commit

Permalink
updates for fused graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Larry Holder committed Dec 22, 2017
1 parent 59c91de commit 61f4618
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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) + '"}}')

Expand Down Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions Subdue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 61f4618

Please sign in to comment.