use template to deal with different edge attributes