support for non-connected graphs