JGraphLayout cost package defines a cost function and default implementations.