connect components in grapgh