Refactor can combine both getGraphFrom

Moved the functions getGraphFromScale and getGraphFromCommunity into
Graph. It is now possible to combine them.