Both "safe" and "minimal" are very, very relative. It's impossible to answer this question precisely without being you.
If you want the bare bones installation, install Ubuntu Minimal and add packages you need to that.
If you're just asking what you can remove without taking down the entire system, that's fairly easy to do with any of the beefier apt-frontends like
synaptic. Select a package for removal and the tool will tell you what else needs to go. If that doesn't work out for you, just revert that change.
You can remove the
ubuntu-desktop package without toppling the system and you will likely need to in order to remove certain things.If you get stuck in a text-mode system, reinstalling that is the simplest route to recovery but it will undo all your work.
Again, building up is easier than tearing down... But it does require you to understand the stack you're working with.
For graphing, you can use something like this (requires graphviz and imagemagick to be installed):
apt-cache dotty ubuntu-minimal | dot -Tpng | display
The graphs are huge though. Rendering takes a while.