An efficient algorithm is presented for the all-bidirectional-edges problem, which is to find an edge-labeling of an undirected network, G equals (V,E), with a source and a sink, such that an edge left bracket u,v right bracket belonging to E is labeled (u,v) or (v,u) (or both), depending on the existence of a (simple) path from the source to the sink that visits the vertices u and v in the order u,v or v,u, respectively. The algorithm works by partitioning the graph into a set of bridges and analyzing them recursively. The time complexity of the algorithm is determined. The problem arises in the simulation of an MOS transistor network in which a transistor may operate as a unilateral or a bilateral device, depending on the voltages at its source and drain nodes. For efficient simulation, it is required to detect the set of transistors that may operate as bilateral devices. Also, this algorithm can be used in order to detect all the sneak paths in a network of pass transistor.