now dividing graph into connected subcomponents. needs testing
fixed merge conflicts