#!/usr/bin/env python

import yaml
import sys

graph_file = sys.argv[1]
x_translate = float(sys.argv[2])
y_translate = float(sys.argv[3])

stream = open(graph_file, 'r')
vtx_list = yaml.load(stream)

for vtx in vtx_list:
    vtx['x'] += x_translate
    vtx['y'] += y_translate

with open(graph_file+".translated", 'w') as outfile:
        outfile.write(yaml.dump(vtx_list, default_flow_style=False))
