initial implementeation of weighed directed graph