refactor edgelist codec into dedicated functions