fixed filename in ui.R
Added dynamic link distance based on link type