some changes preparing to use igraph