changed constructor to graphfactory and added two methods to edge