Understanding Urban Complexity via the Spatial Diversity of Activities: An Application to Barcelona (Spain)

: Urban complexity can be measured by the numerical and spatial diversity of activities in a territory. Just as biodiversity can be measured in a natural ecosystem, diversity indices can be applied to urban settings. Urban diversity presents higher values in areas where there is a greater number of (economic, institutional, and social) activities with a high degree of differentiation between them. This study seeks to investigate the potential of applying an urban diversity index in a speciﬁc case study: namely, the city of Barcelona (Spain), known for the orthogonal grid plan of its Eixample district. Results show that the municipal territory of Barcelona as a whole is characterized by highly differentiated spaces according to their urban diversity values. Speciﬁcally, it is the Eixample district that presents the highest values of urban diversity, reﬂecting the densiﬁcation of its morphology and its urban commercial policies.


Introduction
The relationship between matter, energy, and information constitutes the physical and biological basis of open ecosystems [1][2][3]. In these natural systems, most of the information is found in the genetic package of living things, while, in human systems, in addition to the genetic package, we find additional information that serves to distinguish us in terms of quantity and quality. This is the so-called cultural package, which contains all the information that is not contained in our genes [4][5][6].
In cities, cultural information is organized in various manners and manifests itself in complex ways. While matter and energy can be measured using simple, objectifiable units, the same is not true of information. Attempts to measure information and flows of information using monetary or energy units, or even those derived from information theory itself, have yet to yield sufficiently satisfactory results [7][8][9][10].
Although information is a basic concept, it resists all efforts to be measured. The limits of the total information available are difficult to estimate, and, moreover, information is distributed in different strata, hierarchical and wrapped within themselves [11][12][13][14]. Examining the number of possible pathways in the system is a potential method for measuring information. Indeed, the pathway count is a measure of the complexity and, also, of the inherent uncertainty in a situation that presents any degree of complexity. The "bit" is the unit of information and can be defined as the amount of uncertainty that exists in a situation where it is necessary to choose between two possibilities [15,16]. For each possible pathway, one bit of information is added.
The description of urban systems requires the specification of their functional units, many of which are discrete variables, each of them appearing in a different proportion to the total. There is uncertainty-and, therefore, information-in the possibility that the proportions of the different variables differ, as there is in the organization of the different pathways. Various authors have proposed explanatory models that share the common thread of energy [17][18][19]. In fact, any exchange of energy implies an equivalent increase in potential information [11]. It has been argued that the phenomena of the biosphere, including nature and human beings, can be measured and represented by power pathways and energy flow diagrams [17]. These authors have measured the flows of economic, political, and social power as well as those of the physical and chemical world. They then compared the magnitudes of the processes, applying the basic energy laws of conservation, degradation, selection of maximum power, flow proportionality, and forces to human systems. As far as information is concerned, they consider that their pathways, despite being low in energy, are still energy flows and can be represented in energy diagrams together with the more powerful pathways.
The aim of this paper is to analyse urban complexity by means of the application of a diversity index that employs urban legal entity (ULE) data. The case of Barcelona (Spain) is taken as our reference thanks to its urban singularity and the access it affords to the data required. It is our contention that the diversity of ULEs should be a good indicator for measuring the complexity of an urban ecosystem. The identification and systematization of organized entities that undertake activities with an economic, institutional, or social purpose in a given urban space can provide us with very useful information about differences in uses, economic growth, social inequalities, and effectiveness in the application of specific policies. In order to explore all of these issues, this paper: (1) examines the concept of urban complexity through the diversity of entities in the urban ecosystem; (2) identifies the spatial pattern of urban diversity in Barcelona (Spain) by applying an urban diversity index; (3) discusses the similarities and differences in the scenarios analysed based on the results obtained and proposes further research.

Understanding Urban Complexity through Diversity: An Overview
In recent years, complexity has acquired considerable importance in network analysis. The success of network science in modelling complex real-world systems [20,21] is based on the hypothesis that the interconnections between the elementary units of a system-that is, the network of their interactions-are responsible for the emergence of complex dynamic behaviours [22,23]. Traditionally, relevant contributions for a better understanding of complex networks have originated in statistical physics [24,25], where the main objective is to characterize sets of comparable random graphs with an observed real-world network. However, interesting results have also been obtained from information theory, a field of research that seeks to adapt classical concepts and methods to network analysis [26,27]. In contrast, some other studies have focused on the definition of empirical network entropy measures [28] and on the quantification of the significance of structural indicators based on algorithmic information theory [29,30].
In ecology studies, the information content associated with species composition is a perspective that is taken into account. This function is performed by diversity indices, such as the Shannon-Wiener diversity index (H') [31,32], which is generally employed to characterize species diversity in a community. Here, the amount of information increases with the number of units contained in the system. Moreover, in calculations of the information content of species combinations in natural systems, values can exceed 5 bits of information per individual, because of the many possible combinations. Although the resulting number is referred to as 'information', it does not indicate whether the complexity is organized into a useful combination or whether it is an unspecified random scenario. The information content, calculated as the logarithm of the combinations, indicates the useful amount of information that would be obtained if the system were organized to form a useful message. If the system is not organized, however, it provides an indication of the amount of confusion [11,14,33,34].
The term 'complexity' is the one chosen by most authors when information measures are proposed for a limited, defined objective [35][36][37][38][39]. In the context of an urban ecosystem, complexity responds to the expression of a set of discrete variables with significant information content, their respective abundances and interactions, and the way in which they are integrated in space and time. A high level of urban complexity may depend on such aspects as the urban morphology [40,41]. In some cases, building density values and simultaneous proximity to basic activities are positively correlated with the urban complexity values [42][43][44].
At first glance, complexity is a quantitative phenomenon, that is, an extreme amount of interactions and interferences between a very large number of units [45]. However, complexity does not encompass units and interactions only, it also includes uncertainties, indeterminacies, and random phenomena [46][47][48]. The complexity of urban systems is linked to a certain mixture of order and disorder, and can be analysed, in part, by making use of the concept of 'diversity' [49][50][51]. Living organisms and, above all, the human species and its organizations, are carriers of information, and they dynamically accumulate over time characteristics that indicate the degree of accumulation of information and also their ability to significantly influence the present and control the future.
The discrete variables in urban systems, equivalent to those that play the role of species in natural systems, are essentially attributes that individuals or activities have for storing dynamic information through multivariate relationships, that is, competition and cooperation, among others. These attributes are differentiating elements loaded with information that condition the relationships and the pathways of matter, energy, and information flows. Together they create networks, in which, as in natural ecosystems, each attribute allows for specialization, the division of labour, and other regulation and control circuits [49]. This prior fundamental idea has been adopted by later works as one of the bases of the city seen as an ecosystem [52][53][54].
The human species creates organizations with different attributes that perform specialized activities, and that allow the division of labour and other kinds of circuits of regulation and control. In fact, it is organized entities (not individuals) that actually determine the division of labour and most of the urban regulation and control circuits. The ability of organized entities to influence the evolution of the system is manifestly greater than that of individuals. Citizens subjugate most of their individual intentions and aspirations to the goals of organized entities. Urban organizations achieve their goals through competition or cooperation and this allows them to maintain or increase their relative position and their permanence over time. The position attained usually translates into economic capacity or power. On the other hand, in urban ecosystems, organized entities are the main accumulators of information and, consequently, those with the greatest capacity to significantly influence the present and control the future.
In addition to the ecology studies mentioned above, the organization of information in urban spaces has also been studied from the broader perspective afforded by geography, urban studies, and related disciplines [55][56][57][58][59]. Identifying these spatial patterns of diversity, as well as the organization of information that occurs via a range of uses, activities, and entities, is one of the objectives sought by these disciplines. Among the most frequently used data sources of the study of complexity in urban diversity are those of land use type and points of interest (POI) [60][61][62][63][64]. The study of social media has also been used to analyse concepts parallel to that of diversity, including, for example, urban vibrancy [65][66][67]. Studies of this type combine geospatial analyses and big data in an effort to parametrize not only diversity, but also consumption activities, accessibility, construction density, and other variables of the built environment. The study we report here is consistent with this desire to combine geospatial data and the measurement of human activities to understand urban complexity.

Calculation of the Urban Diversity Index
The measurement of urban complexity requires calculating information that carries a message, and this can be achieved by measuring the diversity of ULEs that carry out some kind of economic, institutional, or social activity. These activities are recognized by the Statistical Classification of Economic Activities in the European Community (commonly referred to as NACE). The complexity of natural ecosystems is determined by calculating their biodiversity, that is, by ascertaining the diversity of living species, and so, by analogy, in urban ecosystems, complexity is determined by calculating the diversity of ULEs.
Previous studies have shown the usefulness of the measurement of urban diversity for specific, applied case studies [43,[68][69][70]. The measurement of a city's diversity can constitute a way of obtaining high quality urban information, in the same way as the more highly developed indicators of mobility, compactness, cohesion, habitability, etc. The Shannon-Wiener index (H ) has been widely used in studies conducted in ecology, biology, and environmental science [31,32,[71][72][73] and can be employed in the study of organized urban entities, where H corresponds to diversity and the unit of diversity is the information bit. Here, p i is the probability of occurrence, and it indicates the number of members who fulfil a particular characteristic in that community. The outcome is the minimum average number of bits required to encode a string of symbols based on the sample size and the frequency of the organized urban entities.
The increase in organized information in an urban system implies the presence of different information activities, with multiple and varied relationships established between them. In urban systems, as in natural systems, organization translates into contacts and exchanges. Complexity, measured as the diversity of ULEs, allows us to know the degree of multifunctionality of each territorial area. For successive points in time, it informs us as to whether the degree of organization is increasing or decreasing and in which parts of the city it is acting in this way.
The measure of urban complexity, therefore, gives us an idea of the organized information in a territory and the amount available at each moment in time. A city's organization is determined by its institutional, associative, and economic activities (including those generated by self-employed workers) and the diversity of these activities. The urban diversity index for a given area will therefore rise as the number of ULEs rises and the more differentiated these entities are one from another. In this way, it is possible to identify the diversity and mixture of urban uses and functions, the degree of centrality, and, in some cases, the maturity of a territory and of the places with the highest concentration of activities and, therefore, of the generation, among others, of the highest number of displacements.

Selection of the Study Area
The area selected for this study is Barcelona (Spain) (Figure 1), in particular its orthogonal street grid plan (occupying the area in the city's districts of the Eixample and Sant Martí). The latter is an area of urban expansion, the work of the engineer Ildefonso Cerdà, considered one of the ideologues of modern urban planning, the origins of which can be traced back to the 19th century. Today, the Eixample is a central city district, home to a large number of economic activities and mobility flows [74][75][76]. The district's regular grid pattern, designed with blocks of equal dimensions and characterized by the continuous intersection between traffic and pedestrian lanes, presents an enormous capacity for reorganization and the change of uses and activities. A good example of this is the pioneering project of 'superblocks', promoted by Barcelona's city council in recent years with the aim of freeing up road space for pedestrian use, in addition to limiting the use of private cars, the origin of much of the city's air pollution [77][78][79][80].

ULE Data, Steps and Sources
The measurement of ULEs through the calculation of their diversity requires data supplied by the administration, and is subsequently validated, digitized, and analysed. In order to obtain data and conduct the research, the following steps were carried out: (a) Information on the number, type, and location of ULEs was requested and obtained from Barcelona City Council (Ajuntament de Barcelona); (b) A digital treatment of the information was carried out using GIS programs; (c) A grid mesh (200 m × 200 m) was created to integrate the ULE data and the application of the diversity index, and, finally, (d) urban diversity maps were drawn in order to conduct a spatial and geographical analysis. The size of the grid mesh tile was chosen to ensure that all the analysed variables were included, while, at the same time, seeking to avoid the simplification of the information (i.e., larger tiles than those chosen) or excessive noise (i.e., smaller tiles than those chosen).
From a technical perspective, the data presented the following characteristics and limitations: (a) The main source of the data was the geolocated census of legal entities in Barcelona; (b) The year of data collection was 2016, the most up-to-date data available at the time of conducting the study; (c) The data refer to the ULEs located on the ground floors of buildings; (d) Although urban activities may be either legal or informal, for the purposes of the analysis conducted here, only those registered in official public data were taken into account (ULEs).

Global Perspective of Urban Diversity
Based on the methods described above, we obtained two maps (Figures 2 and 3) that show the outcomes obtained from the application of the urban diversity index. Figure 2 shows the urban diversity of the whole of the city of Barcelona, while Figure 3 focuses on the city's orthogonal grid, occupying the districts of the Eixample and Sant Martí. In both cases, the legend indicates the bits of information that were obtained, ordered in seven categories (from <2 to >6.5 bits). Figure 2 shows considerable spatial diversity. In general, the central city area presents high values of urban diversity (categories >6,5, 6 to 6.5 and 5.5 to 6) and, as we proceed out towards the city's peripheral fringes, these values present a gradual decrease, especially to the north, east, and south, where the lowest categories are most abundant (2 to 4 and <2). Figure 3 shows a more homogeneous scenario, with the categories with the highest values being located in the central (6 to 6.5), upper (5 to 5.5; 5.5 to 6), and western zones (6 to 6.5 and >6.5). In contrast, the eastern and southern zones of the analysed area present the lowest values (4 to 5.5; 2 to 4 and <2). Globally, the highest values of urban diversity are located in the city's central districts. However, the districts with the highest income levels (i.e., Sarrià-Sant Gervasi and Les Corts), while they present medium to high values of urban diversity, are not the ones with the highest values. The districts that present the highest values of urban diversity are Ciutat Vella (Old Town) and, in particular, the Eixample. We should also highlight the values of the district of Gràcia, especially in its area of contact with the Eixample. The lowest values of urban diversity are concentrated in the city's periphery-on the one hand, in the area that connects the city with the Collserola mountains (the districts of Les Corts, Sarrià-Sant Gervasi, Horta-Guinardó, Nou Barris, and Sant Andreu), and, on the other, in the coastal area, especially to the west of the city, in an area around the city hill of Montjuïc, which forms part of the Sants-Montjuïc district.  Figure 3 shows the urban diversity of the districts of Barcelona designed with an orthogonal street plan. Of the area covered by a regular grid pattern, 62.5% presents values greater than 5 bits. If we focus solely on the orthogonal grid in the Eixample, the area with diversity values greater than 6 bits of information per ULE rises to 87%. As such, this is the area of the city of Barcelona with the greatest urban diversity. In contrast, we detect a fall in urban diversity values in the eastern and southern sectors of Figure 3. This area, although it preserves the original orthogonal structure, is part of the district of Sant Martí. Indeed, a physical interface is clearly visible where diversity values fall and present average to low bit values.

Reasons for Highest Levels of Urban Diversity
The global mapping of urban diversity for the city of Barcelona shows that the results cannot be explained solely by income levels, since two of its peripheral districts with the highest income levels (i.e., Sarrià-Sant Gervasi and Les Corts) do not present the highest values of urban diversity. This indicates that other factors have to be considered as explanations of the pattern obtained. The greater number of commercial and service premises on the ground floors of buildings may account for the high values recorded in the city's central districts (i.e., Eixample and Ciutat Vella). The high density of ULEs, combined with the presence of a notable number of spaces available for the implementation of activities and an adequate distribution of constructions built for commercial and residential uses, gives rise to high values of diversity. While the policy of concentrating commercial premises on the ground floor of buildings is common throughout the city of Barcelona, it has been more successful in the city's central districts [81][82][83].
However, the highest diversity values are found in the Eixample, which suggest that its orthogonal urban fabric (differentiated in this respect from the irregular fabric of Ciutat Vella), characterized by the existence of square, chamfered blocks that present large ground floor surfaces dedicated to economic activities, might account for this difference. The urban expansion that occurred in the Eixample, centred on closed housing blocks, separated by streets 15 to 20 m wide, with population densities greater than 250 inhabitants/ha and with levels of income close to the city average, appears to provide the highest density and diversity of activities, especially when compared to the capacity afforded by other regular and irregular morphologies. Some of the increase in the diversity of the Eixample district today may be attributable to modifications to Cerdà's original project, which has undergone changes, as city ordinances to close off the blocks were approved [76,84]. Originally, the plan allowed a densification of activities in the block's ground floors which, at the time, made the Eixample the district with the highest number of industrial activities. Today, this process of redensification has allowed the installation of an exceptional number of activities, making it possible for the types of activity to change with the changing times.

Reasons for Lowest Levels of Urban Diversity
The lowest values of diversity are found in the city's peripheral areas. In part, this can be explained by the historical characteristics of a group of neighbourhoods belonging to the districts of Nou Barris and Sant Andreu. This area has presented notable socioeconomic deficiencies since its consolidation with unplanned building reaching a peak between the 1950s and 1960s. These neighbourhoods were, in the main, built by migrants from other regions of Spain, attracted by economic opportunities in Barcelona. However, the periphery is not always synonymous with low income or the absence of urban planning. Historic neighbourhoods such as Sarrià (the district of Sarrià-Sant Gervasi) present very low values of urban diversity. A possible explanation is that these are largely residential neighbourhoods, with low population densities and numerous open spaces (including green areas), and that they have not implemented a policy of densification of services and activities.
As discussed above, Figure 3 highlights the significant change in diversity values within Barcelona's orthogonal grid. The boundaries of this change coincide with two of Barcelona's main communication infrastructure: on the one hand, La Meridiana, a major avenue that, in a large part of its route, marks the administrative limit between the Eixample and Sant Martí districts, and, on the other, and in an almost parallel fashion, the route taken by the regional railway which, to this day, has yet to be moved underground. These two lines of communication separate medium and high values of diversity from medium, low, and very low values. The orthogonal grid of Sant Martí coincides with a part of the city that is still undergoing a transformation. Historically dedicated to industry, Sant Martí has yet to adapt to new economic uses, with the exception that is of the so-called 22@, a regenerated sector of the Poblenou neighbourhood that shows high and very high values of urban diversity. Here, policies of concentration, densification, and generation of new commercial and service uses and activities began in 2008 and they continue to be implemented today [85][86][87].

Closing Remarks
The measurement of a city's urban diversity allows us to know not only where there is a greater concentration of urban and legal entities (ULEs), but also where there is a greater number of typological categories and the degree to which they differ. As described, a diverse urban space ensures the coexistence of different economic, institutional, and social activities. From a qualitative perspective, a high urban density in a given space means that space is capable of generating opportunities and benefits for the socioeconomic system. The location of ULEs on the ground floor of residential buildings can bring vitality to neighbourhoods, just as a greater number of establishments can lead to greater plurality and urban diversity. In its turn, greater urban diversity implies greater accessibility to services and facilities for a broader segment of the population, as well as possible benefits for mobility, attenuating the general demand for transport, thanks to the minimization of trips due to the multiplicity of economic supply.
In this study, we have sought to quantify the urban diversity of Barcelona (Spain), taking as a specific case study the city's characteristic orthogonal street grid plan. The results obtained reveal a city of great spatial diversity: its central spaces present high values of urban diversity, while its peripheral areas present low or very low values. Here, there is no direct correlation with a district's level of income, since, while the central districts are the most diverse, they only record medium income levels. The orthogonal grid of the Eixample district is the one that presents the highest values of urban diversity. This can be attributed to the historical evolution of this neighbourhood, its proximity to the central area, the commercial policies implemented on the ground floors of the district's buildings, and the densification of its orthogonal morphology.
This study is not without its limitations, but there are issues that can be fruitfully addressed in future research. First, it would be interesting to employ a diachronic approach (should the data be available) to the same case study, as this would facilitate a comparison of the city's urban diversity at different points in time. Second, it should be bore in mind that the registered ULEs may not represent an urban space. A city's informal activities can only be identified and recorded in the field, which means the introduction of fieldwork would be a useful tool for further developing studies of this type.
Finally, we wish to propose a series of future research lines. On the one hand, we consider it important to carry out new studies that integrate an evolutionary, historical, and comparative perspective, with the aim of analysing and generating the latest data as they become available. Urban diversity is subject to constant change, which means the diachronic approach suggested above can help us understand how ULE pools are generated. Clearly, performing such analyses for both pre-and post-COVID-19 scenarios would be of interest, as would the historical comparison of regular grids in different case studies. On the other hand, it would be of great interest to examine in depth the possible relationship between morphology and diversity, and to measure urban complexity using human mobility data [88,89] and urban ecosystem services [90][91][92][93][94].
The results obtained from this future research should generate opportunities for urban management, planning, and design. Conducting such studies should provide important insights into which areas of a city or a territory (and, at an even broader scale, of a region) have the greatest urban diversity. Being able to identify the behavioural patterns of diversity means we will be one step further forward in understanding the organization and specialization of urban activities. The results of analyses of this kind, moreover, can help determine the factors that generate diversity and, at the same time, lead to the implementation of corrective or adaptive measures as well as actions of economic impulse.
Author Contributions: Conceptualization, methodology and formal analysis, S.R.P.; investigation and writing, S.R.P. and A.S.R.; software, resources and data curation, S.R.P. and B.C.I.; visualization, supervision and funding acquisition, S.R.P., A.S.R., J.T.D. and X.Ú. All authors have read and agreed to the published version of the manuscript.