Fix naive graph theory to cope with statement labels.