Laying groundwork for Floyd algorithm