KCC: move functions used in kcc.graph into kcc.graph