Topological conditions for the unique solvability of linear time-invariant and time-varying networks