graph: adding graph merging.
minor: making exception python 3 compatible
fixing key name error in graph
avoid loading graph if invalid arguments