improved graph operation