graph and segment as one class