Topological Generalization Bounds for Discrete-Time Stochastic Optimization Algorithms