BUG: Fix shadowed variable in TubeGraphKernel

Also make variables const, where appropriate.

Change-Id: I78a5ef4297bc808c2ed99d24353e8676943db2c7