basic implementation of line graph