The python networkx library has many useful graph algorithms, but they require to construct a networkx.Graph, which may be wasteful. As an example,
networkx
networkx.Graph