Let's assume there is a polyline layer 'lines_test' with an imaginary bus route #1 (into town and from town), see image below

To get a sequence/rank of lines (polylines) in QGIS, there are couple of steps that can be followed.
Step 1. Use the "Explode lines" geoalgorithm that will create line-strings out of the original continuous feature.

Step 2. Here use the "Add autoincremental field" tool with "Direction" in the Group values by. It will sequentially arrange the lines for each bus route based on the direction of route.

and get the output:

If you are not satisfied with order of your vertices in some polylines use the ReverseLine
from the Advanced Digitizing Toolbar. Other details you may find in this thread Changing (flipping) line direction in QGIS?.