adding acyclical weighted graph