A possible solution to this problem is to manually add the _build folder to the .merlin file in your project root directory. You will need to keep the build files of the external dependencies by doing opam install -b --deps-only first, however.
Hi,
In the case of ocamlgraph, this is not an opam issue, this is a build system issue. To expand a bit, it’s up to each build system to tell opam what to install: mli files, cma files, cmt files, etc. A build system like dune will do the right thing by default and install cmt/cmti files, but older packages like ocamlgraph deal with their installation by hand using a Makefile.
There’s a dune port (that should install cmt files) at https://github.com/dune-universe/ocamlgraph/tree/duniverse-v1.8.8. You can also try to patch the Makefile, but in the long run I think it’s better to adapt the build system so that this is taken care of automatically.