Abstract-We develop on-line routing and wavelength assignment (RWA) algorithms for WDM bidirectional ring and torus networks with N nodes. The algorithms dynamically support all k-allowable traffic matrices, where k denotes an arbitrary integer vector [k1, k2, ..., kN ], and node i, 1 ≤ i ≤ N , can transmit at most ki wavelengths and receive at most ki wavelengths. Both algorithms support the changing traffic in a rearrangeably nonblocking fashion. Our first algorithm, for a bidirectional ring, uses (ki)/3 wavelengths in each ring direction and requires at most three lightpath rearrangements per new session request regardless of the number of nodes N and the amount of traffic k. When all the ki's are equal to k, the algorithm uses kN/3 wavelengths, which is known to be the minimum for any off-line rearrangeably nonblocking algorithm. Our second algorithm, for a torus topology, is designed for the special case with all the ki's equal to k. For a square torus network with N nodes, the algorithm uses k √ N/2 wavelengths in each fiber, which is shown to be at most two times a lower bound obtained by assuming full wavelength conversion at all nodes. In addition, the algorithm requires at most √ N −1 lightpath rearrangements per new session request regardless of the amount of traffic k.