New version: with graphs