Fancy networks

See docs/networks.md for details.

Unit tests pass, but I should write some more unit tests to test the expanded functionality before we merge this.
Please put a docstring here. I actually can't tell what invariant this is checking. Why should this fail?