Weighted graph

Here, you're using different exception types to specify a missing edge vs. a missing node.  Your user won't necessarily know (or want or need to know) that your nodes and edges are stored in a list and dictionary, which are the contexts that IndexErrors and KeyErrors are relevant in.  You may want to pick another exception, or write a custom exception, that will apply nicely to an abstracted graph in the case of either missing nodes or missing edges.