Hello, I'd like to help you with your question.
It sounds like your ex wife may have a severe mental illness. And that can be hard to cope with, particularly when there is added stress
to the situation with your ex mother in laws passing. That could lead to an increase your ex wife's symptoms. But this invitation is about your daughter so doing what you can with the situation so you can attend would mean a lot to your daughter.
When dealing with someone with a mental illness who acts out and tries to hurt or manipulate, it is always a good idea to stay away as much as possible, just as you have done. If you do decide to attend your daughter's graduation, then try doing the same thing even when in the same room with your ex. Keep a lot of distance in between you both. And if you can, take your wife with you but if you feel that may cause more problems, try taking a trusted friend or a keep a relative who understands the situation nearby. That way, your ex cannot accuse you of any wrongdoing. And if your ex tries to approach you and says something to you, keep your responses very neutral. Respond to anything emotional with something like "I'm sorry you feel that way". That keeps you from getting upset and emotionally involved and it gives your ex little to respond to.
Also, stay for the required amount of time at the events then leave as soon as you can. You can spend some time with your daughter outside of the events so you can be with her without all the drama of your ex wife's issues interfering.
Also, talk with your daughter about the situation. Make sure she knows that you are not blaming her or trying to make her responsible but that you do have to find ways to cope with her mother while you are there because of her behavior. If you are open with your daughter, she will understand.
I hope this has helped you,