in clutrr/relations/puzzle.py [0:0]
def convert_node_ids(self, stype='story'):
"""
Given node ids in edges, change the ids into a sorted version
:param stype:
:return:
"""
if stype == 'story':
edges_tc = copy.copy(self.story)
elif stype == 'fact':
edges_tc = copy.copy([fact.fact_edges for fact in self.facts])
edges_tc = [y for x in edges_tc for y in x]
else:
raise NotImplementedError("stype not implemented")
node_ct = len(self.story_sort_dict)
for key in edges_tc:
if key[0] not in self.story_sort_dict:
self.story_sort_dict[key[0]] = node_ct
node_ct += 1
if key[1] not in self.story_sort_dict:
self.story_sort_dict[key[1]] = node_ct
node_ct += 1