DOC : fixed minor error in using topological sort

`topological_sort` is a function in `nx` not an instance method of a directed graph.

It is also a bit annoying that code to generate the graph relies on imports at the top of the example file it is sourced from.

Sorry for the white space changes, I can revert them if they really are a problem.