A Graph-based Economical Dispatch Model