Graph Criterion for Regular Maps of Affine Varieties