added check against isDirected upon graph construction