Let R be a commutative ring with identity. An edge labeled graph is a graph with edges labeled by ideals of R. A generalized spline over an edge labeled graph is a vertex labeling by elements of R, such that the labels of any two adjacent vertices agree modulo the label associated to the edge connecting them. The set of generalized splines forms a subring and module over R. Such a module it is called a generalized spline module. We show the existence of a flow-up basis for the generalized spline module on an edge labeled graph over a principal ideal domain by using a new method based on trails of the graph. We also give an algorithm to determine flow-up bases on arbitrary ordered cycles over any principal ideal domain.