#!/usr/bin/env/ python

import sys

import heiankyoview as HV

if __name__ == '__main__':
	# TODO Use ArgumentParser

	fn = sys.argv[1]
	g = HV.EdgeList.read(fn)
	#print(g.size())
	#print(HV.BFS(g))

	tp = HV.TreePacking(g)	
	tp.pack()

	nodes = []
	L = HV.BFS(g)
	#print(L)
	for n in L:
		rect = g.getRect(n)
		nodes.append( (n, rect.x, rect.y, rect.w, rect.h) )

	HV.p(nodes)
	output = "\n".join( ["%s,%f,%f,%f,%f" % tup for tup in nodes] )
	print(output)
