osurs
0.0.1
|
Routing connections between nodes on the network without transfers. More...
Functions | |
Connection * | new_connection (const Node *orig, const Node *dest, int time) |
Create connection between nodes. More... | |
int | check_connection (Connection *connection, int seats, int *trip_count) |
Check if seats are available in connection. More... | |
Connection * | select_connection (Connection *connection, int seats) |
Selects the best connection. More... | |
void | delete_connection (Connection *connection) |
Delete a connection. More... | |
Routing connections between nodes on the network without transfers.
Public transit routing without transfers, checking seat availability and selecting best connections based on arrival time.
int check_connection | ( | Connection * | connection, |
int | seats, | ||
int * | trip_count | ||
) |
Check if seats are available in connection.
Check a connection if the desired number of seats is available. This is important since reservations can change or avoid double booking of a searched connection.
connection | The queried connection to check. |
seats | The number of seats to check. |
trip_count | The trip number on the route, needed for getting the reserved count. |
void delete_connection | ( | Connection * | connection | ) |
Delete a connection.
Frees the memory from a connection chain on the heap.
connection | The connection chain to delete. |
Connection* new_connection | ( | const Node * | orig, |
const Node * | dest, | ||
int | time | ||
) |
Create connection between nodes.
Searches connections between nodes on the network considering a departure time. If more than one connection is possible between to nodes on the network, a connection chain is created. In a connection chain, the .last property of the connection structure points to the last connection or NULL if it is the root of the chain. Identically, the .next property points to the next connection or to NULL if it is the end of the chain.
orig | Origin node in network for connection. |
dest | Destination node in network for connection. |
time | The departure time in seconds after midnight (00:00:00). |
Connection* select_connection | ( | Connection * | connection, |
int | seats | ||
) |
Selects the best connection.
Chooses the best connection based on arrival time and seat availability.
connection | Connection results from new_connection(). |
seats | The number of seats that should be available on the connection. |