#### A question about real-time passenger flow, how to design the database and how to realize this function?

1. Requirement: I need to do a bus passenger flow display now. Different displays are used to display the bus passenger flow, similar to the real-time road conditions in the map. All the states are set manually by the backstage.
2. there is a line 1. there are stations A,B,C,D,E,F,G,H, which can travel like A->H or h-> a. set A->B to state 1, B->C to state 2, C->H to state 3.
The displayed status is:
A-state 1-> b-state 2-> c-state 3-> h
If B-E is set to State 4 again, the display state is:
A-state 1-> b-state 4-> e-state 3-> h

The same is true for reverse travel.

At present, there is no idea how to do this, including how to design the database. I hope you can give me a thought, thank you.

=======================================================================
If there are multiple lines and the lines can cross, what should I do?
For example, there are two lines line1 and line2；. There are stations a, B,C, d, e, line2 in line1 and stations a, b, c, d, e, f;
If you need to set A->f to state 1, (A->B->C->D->e->f) to state 1,

How to do this, if it is n lines

I throw a brick occasionally-when saving the database, it is divided into small pieces according to the minimum granularity:

``````| begin | end | status |
| A     | B   | 1      |
| B     | C   | 2      |
| C     | D   | 3      |
| ...   | ... | ...    |
| D     | C   | 1      |
| C     | B   | 2      |
| B     | A   | 3      |``````