modified R-igraph2.R