improved region generation algorithm; show region connections