added support for ordering graphs