**1. Introduction**

Bicycle sharing systems (BSSs) are one illustrative example of the new sharing economy, which is exponentially increasing at present, with grea<sup>t</sup> impact on mobility [1]. At first instance, they have arisen as a perfect complement for public transport in cities, covering the last-mile segmen<sup>t</sup> [2]. In this respect, BSSs provide the convenience of unidirectional short hops, which enhance the connections to other transport modes: bus, metro, train, etc. Under this perspective, BSSs are just conceived as supplementary to the main transport network. However, BSSs can also be considered a transport mode in their own right, which contributes to the overall objective of reducing car use [3]. This reduction implies a direct positive impact on environment and health [4].

BSSs show specific characteristics that make them different from most transport modes: their use. Cars, buses or trains are primarily used as a means of moving people from one place to another. These trips are performed to reach the workplace, the residence, a commercial area, a sport center, or a tourist site, among others. In this respect, we can observe that the purpose of these trips is mainly defined by their destination. BSSs are fundamentally different as the users' purpose is inherent to the trip: not only can they be performed to reach a destination, but also trips themselves can be a form of sport or tourism, for example [5].

With greater understanding of their usage patterns, BSSs could be optimized, tailoring them to each city and neighborhood. The current knowledge about BSS usage is still embryonic and the need to identify sub-modes of the different mobility activities taken by BSS users is an essential step in this process. However, as our understanding increases, so will our design criteria and planning. BSSs can be re-purposed and redeployed with very little capital investment and virtually no infrastructure change. These small budget requirements will allow the expansion of BSSs, which offers a high degree of granularity, making them an extremely useful tool in the upgrading of mobility services.

Human mobility is a complex problem. Fortunately, some aspects of this complexity assist in the problem analysis: (i) people move according to regular patterns [6]; and (ii) they return to a small number of places [7]. To move, people choose public transport or private vehicles considering measurable factors, such as travel and transit times or economic cost [8], and other non-measurable factors, like convenience, safety, comfort, or environment [9].

This extensive set of factors complicates the task of modeling human mobility and, in particular, the election of a BSS as a transport mode. In the absence of data, we must rely on probabilistic methods [10]. However, in this case, although not complete, we do have access to some information. BSSs often provide data regarding the occupancy of docking stations, which we can employ to infer the demand between them [11]. From this information we can then extract a set of behavioral profiles for each docking station, such as *morning peak*, *morning arrival*, *flat* or *anomalous* [12].

Presently, 4th generation BSSs provide trajectory data, which allow us to construct more accurate profiles [13]. These trajectories can also be extracted from other by-products like call detail records (CDR) collected by phone companies [14]. However, this approach is often biased by the specific population that formed the dataset [15].

In this work we analyze trajectory data from BiciMAD, a 4th generation BSS in Madrid, Spain, and create a data-driven methodology to classify trips into two main groups depending on their intrinsic purpose: transport and leisure. We understand as *transport trips* those performed to reach a specific destination in the shortest possible time. This reflects that the main purpose of this category of trips is getting to the destination to develop certain activity like working, studying, shopping, etc. On the other hand, we understand as *leisure trips* those performed to wander around the city or as sport. In this respect, the fundamental objective of leisure trips is not the destination itself, but the route traveled along a sequence of points of interest (tourism) or the overall length of the path (sport).

In addition, this methodology allows us to infer the underlying public transport network of a BSS. Most transport modes are composed by a permanent set of nodes (stations or stops) and a structure of fixed edges [16], i.e., the specific routes of buses or trains. On the contrary, a BSS has no fixed edges given that users can cycle following whichever route they prefer through the road system, parks, bicycle lanes, etc. This makes the extraction of the underlying transport network a challenging task. Our methodology provides a rigorous way of inferring the BSS transport network from trajectory data, thus contributing to reach a complete understanding of the overall multiplex public transport network [17] of a city.

Consequently, the main contributions of this work are:


In the following sections we first propose a mathematical framework to classify BSS trips (Section 2). Next, in Section 3 we present and validate the results of applying this framework to a real dataset, providing the methodology we used to calculate the different variables it involves. From the basis of the resulting classification of trips, Section 4 shows the underlying transport and leisure networks we extract from the real trajectories falling on each category. Finally, Section 5 summarizes the work and discusses its benefits for municipalities and BSS managers. Please note that this structure does not include a specific section devoted to analyzing scientific works in the field. Instead we have placed each reference in the particular section that required it. This way the reader can easily follow the text eliminating the need for returning to a previous section to check each reference.

#### **2. Data-driven Classification of Trips**

The present section is devoted to describing the mathematical framework that builds the basis of the method of trip classification we propose. First (Section 2.1) we set up the starting premise upon which we will construct the trip classification methodology. This starting premise is based on observing trajectories and detecting how close they are to the shortest path. Then we create a trip index as the fundamental metric, which compares the actual trajectory to a reference (Section 2.2). However, this reference is not unique as BSS users can find shortcuts to reduce their overall traveled distance; thus, we study the resulting spaces and trajectories in Section 2.3. Finally, in Section 2.4 we define the shortest path applicable to a BSS and the subsequent trip index.
