The Contextual Ego Network P2P Overlay for the Next Generation Social Networks

Internet has completely evolved in recent years, and smart devices, such as mobile and IoT devices have become pervasive in the daily life of people. Internet is becoming more social, and Online Social Networking platforms (OSNs) have become part of the real life of people. Current Online Social Media platforms are centralized. Centralization presents several drawbacks, and during the last years several privacy issues have been arisen concerning the control of private data. Indeed, those platforms offer inadequate guarantees where it concerns the privacy of their users. These problems have been confronted by exploiting decentralized solutions. Decentralized Online Social Networks (DOSNs) guarantee more control over private data. Thanks to the definition of a Next Generation Internet focused on people, the need for a new generation of Decentralized Online Social Networks, which puts the user at the center of the system, has been arisen. The HELIOS project tackles this issue by introducing a new decentralized paradigm. In this paper, we present the Contextual Ego Network (CEN), a new P2P Social Overlay built by exploiting the real life of users. We propose a formal definition of the structure, the implementation of the structure in a Java library, and a preliminary analysis in order to evaluate the homophily of each context.


Introduction
Internet has completely evolved in recent years, and smart devices, such as mobile and IoT devices have become pervasive in the daily life of people. This change is the principal goal of the Next Generation Internet (NGI) is the well-known Cambridge Analytica scandal 2 which erupted in early March 2018. Last, but not least, current OSNs are focused on keeping the user always engaged with more interaction opportunities and new content, not really caring about the user experience and the quality of the interactions.
These problems have been confronted by exploiting decentralized solutions [21,30]. A Decentralized Online Social Network (DOSN) [12] is an Online Social Network implemented on a distributed information management platform, such as a network of trusted servers, P2P systems or an opportunistic network. In recent years, DOSNs have been the focus of several works and projects from both academic researchers and open source communities. By decentralizing OSNs, the concept of a service provider is changed, as there is no single provider but a set of peers that take on and share the tasks needed to run the system. The first big project in this area has been Diaspora, 3 which counts more than 600,000 users to date. Three years ago, in October 2016, Mastodon 4 was launched. Mastodon is an online social media platform that allows anyone to host their own server node in the network. HELIOS 5 represents a step forward in the definition of a new generation of DOSNs. Instead of having more relationships, making more interactions, and thus people engaging more, the trend should be to make the user have better relationships, and better interactions (posting, commenting, etc..), in such a way that a more meaningful ecosystem of interactions is created around the users. HELIOS proposes a new generation of Social Media built around the user, by advancing the current approaches to social media, and by introducing novel concepts for maintaining and configuring personal social graphs by exploiting context social data that are available when the application is running.
The purpose of this paper is to present a new P2P Social Overlay and to describe its implementation, named Contextual Ego Network (CEN), which represents the P2P overlay of HELIOS. The main goal of our P2P Social Overlay is to represent the social interactions between the actors of the HELIOS application, which are heterogeneous in nature (sensors, human, etc.). Nodes of the Heterogeneous Social Graph can manage the information about their social contents by exploiting a stack of Ego Networks [16] modelled with a Pillar multi-network [27]. Each layer of the structure represents a user's context, and it is formally represented with the Ego Network Social Model, by using an undirected weighted graph. We provide a Java library, which will be used by the HELIOS app to manage the social structure. Finally, we propose a preliminary analysis in order to evaluate the homophily of contexts in the CEN. Results show that the CEN library guarantees a high level of homophily, and as a consequence, meaningful relationships. We compare our contexts with a well-known approach which provides similarity circles.
The rest of the paper is organised as follows: Section 2 contains the state of the art. In Section 3 we present a general overview of the HELIOS platform. Sections 4 and 5 provide an overview of the problem concerning the Context detection in the HELIOS project and the description of the Proximity Detection issue, respectively. Section 6 provides both the formalization and the description of the Contextual Ego Network as the local view of the HELIOS users. Furthermore, in Section 7 we provide the description of the CEN library and how it is organized. Section 8 provides a preliminary analysis of the CEN. Finally, Section 9 provides conclusions and a set of possible future works.

Background
In this Section we provide an overview of the current generation of Decentralized Social Networks, by describing the state of art of DOSNs, the technology of Mobile Social Networks (MSNs), and an overview of the current approaches of Blockchain-based Online Social Networks (BOSNs).

DOSNs
The main difference among DOSNs can be expressed with the level of decentralization. Indeed, several current online platforms are federated, which means that they are not fullydistributed because the network is built upon a set of servers which communicate in a P2P fashion. Today, FeDiverse is the principal project including current federated Online Social Networks running on several servers distributed across the world. It includes active platforms, which are used by real user communities. Between these platforms, the most well known and active are Diaspora and Mastodon. Table 1 lists all the platforms included in Fediverse with information about the type of platform and the protocols used in that platform.
Regarding fully-distributed solutions, several works have been proposed during the last ten years [6,7,11,18,33]. In a fully distributed solution, no servers are used and all the social services are distributed among the nodes in the network. The main difference among fully distributed DOSNs proposals concerns the technologies and techniques used to store data. A possible classification taking into account this difference has been proposed in [19]. An important challenge of fully-distributed DOSNs is to guarantee the availability of such contents, when the data are distributed among the nodes in the network, and by considering the online/offline activity of users [14,17,38].

Mobile social networks
Today, mobile phones and Social Networks have become part of the daily life of people. Indeed, smartphones can be considered as the online alter-ego of people, and are affected by the same mobility patterns of their owners. A Mobile Social Network (MSN) is a social network where people with common interests meet using a mobile device. These platforms deliver OSN functionalities combining techniques from social sciences with wireless communication for mobile networking [23]. At a high level, an MSN architecture is shown in [2]. Introducing mobility, a new, orthogonal, dimension to the system, adds more problems but also provides more opportunities to solve them. An important feature of the MSNs is that mobile devices are able to capture contexts including locations, time, etc. This means that MSNs are also able to connect people through their common physical context. MobiClique [36] is a MSN middleware which is bootstrapped with a profile available on existing OSNs (virtual world) and which then enables opportunistic temporary connections based on physical proximity and social compatibility (physical world). The downside of this approach is the inability to predict user contacts, which leads to using message flooding to implement content dissemination. AdSocial [39] is a MSN which supports presence detection, games, chat, voice and video calls over an ad hoc network, specifically targeting small mobile devices, which have strict resource constraints. AdSocial uses MAND (Mobile Adhoc Network Directory), which is an ad hoc networks specific distributed directory service, to locate nearby users and to determine their address.

Blockchain online social networks (BOSNs)
In the last three years, the decentralization of OSNs have seen the rise of Blockchain-based Online Social Networks (BOSNs). These platforms give more importance to the content by providing rewarding systems and removing the problems of privacy and fake news through the blockchain technology.
Steemit [9] is a Social Media platform that rewards users for their social contents. It has more than 1 million users and thus represents the most well-known BOSNs. An important characteristic of Steemit is that, compared to most blockchains which are too slow and expensive to be used for apps, it is fast, free, and scalable, since it uses the Steem blockchain, as explained on the website. 6 Sapien 7 offers a Web 3.0 social platform with the aim of giving users more control of their data, rewarding users, and preventing fake news. It is a democratized platform built on the Ethereum blockchain. The Sapien Network consists of the Sapien platform, marketplace, API integrations, and third-party applications, all connected and powered by SPN, an Ethereum-based utility token.
Minds 8 is an open source Social Media service that rewards users for their contributions with tokens on the Ethereum blockchain. FORESTING 9 is a Singapore-based social media platform built on the blockchain that supports all types of content, including images, videos, audio, or live broadcasting, and provides rewards for content creators based on an assessment of the users' content. The Foresting platform runs on the Ethereum blockchain with a token called PTON.

HELIOS: the new generation of DOSNs
HELIOS is a Decentralized Social Media platform that addresses the dynamic nature of human communications in three dimensions: contextual, spatial and temporal. HELIOS will advance the current approaches to social media by introducing novel concepts for social graph creation and management by exploiting trust and transparency. Indeed, HELIOS introduces a novel way to create, maintain and configure personal social graphs by exploiting context social data that are available when the application is running. The application follows the current approaches to the decentralization of Social Media. This issue has been faced by DOSNs mainly based on P2P solutions, by MSNs which represent a different social paradigm, and finally by BOSNs. HELIOS represents a new generation of DOSNs where all the previous distributed technologies are mixed together in order to overcome the limitations of the single technology. For example, HELIOS addresses the limitation of MSNs concerning the prediction of users. Moreover, HELIOS can overcome the problem of current BOSNs where usually data are stored in the blockchain, and/or the rewarding system significantly changes the feel of users. Indeed, the gain becomes the main motivation. Moreover, HELIOS is a people-oriented platform which considers the behaviour of users in order to manage the Social Network. The main goal of HELIOS is to be a useful tool for a user. Figure 1 shows the structure of the HELIOS Core, which is composed by a set of modules implemented to manage specific functionalities. In this paper we highlight the functionalities of both the Social Ego Network Manager and the Context Manager because they are involved in the creation and in the management of the structure (see Fig. 1). For the sake of readiness, the Contextual Ego Network is the structure used to model the social relationships of a user, and the Social Ego Network Manager handles the communication between the structure and the real Fig. 1 A representation of the HELIOS Core environment by providing APIs to retrieve information about the contexts and other nodes in the network. In detail, when a specific event happens, the Contextual Ego Network is triggered by the Social Ego Network Manager. The possible events are considered in the lifecycle of the CEN, which consists of: -Creation. A CEN is created when the device owner starts to use the HELIOS Application. -Add/Update/Remove a context. A CEN is a multi-layer network where each layer consists of a specific context detected from the HELIOS Core. Based on the user activity, contexts are created, updated, removed. -Add/Update/Remove an alter. When a specific context is created and added to the CEN, it will be populated by adding alters. When the application retrieves a similarity between the profile of an alter and the profile of the ego, the alter is added to a context. As in common Social Networks, the relation between two users evolves over time. For this reason, an alter can be also updated, which means, for example, update information about the relationship between the ego and the alter, such as the trust score. Finally, the relation can be removed.
The Context manager handles all context-related monitoring and reasoning for the user. Besides hosting the framework for extracting the current context, it will also need to have access to local (device-related), since those are building the context extraction properties. A context can contain several information, for instance, trust, timestamps (established, last sent, last received), etc. In Section 6 we provide a specific formalization of what is a context in the Contextual Ego Network.

CEN: the context detection issue
The Contextual Ego Network is generated by considering the context concept. Indeed, context in the HELIOS platform represents a collection of a specific information, which helps the adaptive behavior of the network, including ego network, communication behavior, trust levels computation, etc. Context may be derived from environmental information through sensor data, as well as additional data from the applications on the device (calendar, contact, etc) and data accessed from a variety of databases, queried by the context module.
Some important attributes of context and context identifications include validity check, relevance and reliability as well as previous context history. Some context information can also be derived through communication packets, as well as sent through raw data or within protocols from the TCP/IP stack. Context data can be gathered from internal device sensors, as well as IoT external or environmental sensors queried by the devices to expand or improve context derivation.
The HELIOS Context manager holds relevant information to the context identification and representation of context for the communication and other modules. Certain attributes of context can be stored within the module -type of situation, value of situation, time stamp of last change and computed reliability value. A context derived unit can be formed as a context tuple, containing arbitrary data, including type of context, which can be textual to describe the relationship, values to denote address etc.
One can have passive context detection -where the device collects sensor data, infers context, presents it to the user but allows a user to manually decide the context and change the application behavior.
In the next of the Section, we provide a detail analysis of context detection in literature.

Context-aware sensing
According to Abowd et al. [1] context represents information used to describe the situation of an agent (person, device, bot, etc.), seemed relevant to an agent interaction with the environment or with other agents. Context in this sense is an information relevant to the description of a situation an agent finds itself in. As such context cannot be limited only to location and position, but social aspects, time of day, environmental data might be considered part of the context. In literature, context has been defined as a combination of an agent's location, environment, identity and time [34], and [15] depicts context as all information required to describe a situation an agent finds itself inlocation, identity, state of agents (including people, groups, sensors, computational objects). Several features of a context have been proposed in [41]. Each of those features can be used in a specific situation, and depending on the situation, environment and intents, different context classification scheme might be used to define context. Several papers [35,42], have provided a survey on popular context modelling methods.
Initial version of context definition involves a hierarchical model, which consists of both statically and dynamically defined contexts. The former includes four main statically formalized contexts: home, work, transit, leisure. Those contexts can hold temporal regions, for example typical working day will be from 9 : 00 AM until 17 : 30 PM. If home context is between 20 : 00 PM and 6 : 00 AM, between those context, the transit context can be derived. Within those several contexts, a further sub-partitioning is represented, which is derived based on variety of sources, including sensors data, google places, calendar, email, physical agent's information, agent's interaction habits and historical data, in an automatic and unsupervised manner. This means that establishing and monitoring of a context, one requires the obtaining of raw contextual data, mainly from device sensor readings, as well as IoT devices in the environment.
Social data can include personal data, physical (movement type-sitting, standing, walking, running) and mental state, position activity, personal connections. Location includes not only geolocation, but whether inside/outside a building, spatial aspects such as temperature, light, noise, humidity, motion, time, weather.

Proximity detection
Proximity detection involves a system able to identify the co-presence of two or more entities. Proximity can be defined as a location (agent closeness on space), time and occurrence of relative closeness. Variety of factors and not only discrete location play a role in detecting proximity. Proximity based technology can be described as having a fixed location, a data transfer mode, and limited area for communicating with other devices. Today, one can utilize smartphone sensors or other stationary sensors to either sense or infer proximity in terms of agent's co-location, or nearby presence of agents. We generally can consider two types of proximity measurements: directly received values from sensors, and presence of a signal based on phenomena or stationary IoT device. With proximity sensors one can detect the presence of nearby agents without the necessity of physical contact. Several methods have been proposed in the past to measure human proximity [32,40].
Today, mobile devices are equipped with multiple sensors, allowing them to measure a significant amount of their surroundings -from distance to noise. GPS sensors, accelerometers, magnetometers, gyroscopes, light sensors, microphone and cameras are available on almost all smartphones. Additional sensors might include thermometers, hydrometers, heart rate and radiation level ones. From the communication technologies -GSM, Bluetooth and Wifi's are available, with many devices having NFC enabled technology as well.
With a bluetooth scan, performed at a predefined time intervals, the presence of enabled near-by devices can be detected and based on these data, one may infer an agent's proximity. This can be achieved also through trilocation with Bluetooth beacons in a stationary locations (i.e. office, restaurants, etc). To detect proximity through Bluetooth one does not require the devices to be paired. As such, one can use the bluetooth advertising message to determine network proximity of devices and save it for future reference. Therefore a device broadcast in a message its own name, hardware address, RSSI, timestamp of sent message and as such can be seen as creating a node in an ego network by receiving such advertising message. An advantage of bluetooth derived proximity is that one uses weak positioning and due to the limited area of bluetooth it reduces problems of location privacy while providing good location proximity [29]. One should note, however, that the radius of the bluetooth scanner is limited to about 5-10 meters, with walls and other obstacles (depending on material) acting to reduce the signal strength. Within a bluetooth proximity detection, two steps are needed. An inquiry -where an ego discover alters devices in a proximity, and the follow up communication between the two nodes when communication is established.
Based on RSSI values, a possible approach implemented in HELIOS can detect human proximity by a device periodically broadcasting an advertisement packet which contains a UUID and also scans for nearby devices. Once a device receives such advertisement packet, the RSSI value of the signal is recorded as well. The relative proximity of two devices is computed based on the obtained RSSI values at certain time intervals. A benefit of this method is that it can be used both indoor and outdoors, furthermore, compared to GPS data and audio/video recordings, bluetooth device information contains lower privacy issues. A problem with Bluetooth usage is that users might have disabled their bluetooth device, or because of a certain software mobile platform not all devices can be discoverable at all times. One can therefore use the wifi sensor and hotspot capability of a device. For that a two step approach is currently required. In the first step, a device scans for a nearby devices through its wiFi sensor. In the second step, the same device switches its hotspot on in order to be discoverable to nearby devices. The switching between wifi scan and hotspot is done periodically. Importantly, the device can neither advertise or search for devices in the time required to switch between the two modes and this time cannot be reduced since it is hardware related. This approach might be later supplanted by the upcoming implementation of Wi-Fi Aware [8] (also known as Neighbor Awareness Networking (NAN)) which can simultaneously detect and advertise WiFi enabled devices in the proximity. NAN enabled devices synchronize the time and channel, through which the discovery service is carried out. The protocol, enabled on the devices runs in the background, scanning continuously for devices, and it would consume less energy, compared to the wifi/hotspot switching [37].

Contextual ego network
In this Section, we introduce the enriched structure called Contextual Ego Network. The Contextual Ego Network is one of the most important parts of the HELIOS framework because it represents the people-centered approach.
From a general point of view, a graph is a collection of nodes and edges, where nodes correspond to actors, and edges are the connections between the actors. P2P systems have a network topology that is defined as overlay network. In current DOSNs, the network topology is represented by the Social Network graph, which is usually modelled by a Social Overlay [18,31]. A Social Overlay is a logical overlay in which peers are connected to known peers. An edge between a pair of nodes indicates that a tie exists between two adjacent nodes.
However, due to the huge amount of nodes in a P2P network and by considering the distributed nature, nodes maintain only a subset of the nodes in the network in a local view, and several heuristics are proposed to build the local view of a node by taking into account a specific scenario. In a DOSN, the common heuristic is to have a local view containing only the friend nodes. The Ego Network [28] is a well-known social network model used to model the local view of a node in a DOSN. The Ego Network of a user represents a structure built around the user itself, also known as ego, which contains her/his direct friends, known as alters and may also include information about the direct connections between the alters (Fig. 2).
The vision of HELIOS introduces two important aspects, which are reflected in the model used to implement the Social Overlay of the system. The first aspect is the nature of an actor involved in the overlay, which could be a human or an object. The second one is contextual networking, which means that the real-life activity of a user must model its local view as a virtual view of daily life.
A Contextual Ego Network is a complex model organized in layers, where each layer represents a real-life context of Fig. 2 An Ego Network representation. The red node is the Ego Node, and the blue nodes are the Alters the ego. Each layer, in turn, can be implemented as a simple Ego Network, where actors are heterogeneous (human and/or sensors available in the smart environment), and links between two actors describe specific relationships according to the nature of the actors and the context in which they are in. The definition of the Ego Network considers the alter-alter ties. This is usually a derivable information, because when information about social contacts is exchanged, nodes can find the intersection of social contacts. In HELIOS, specific privacy issues will be managed by the Security and Privacy Manager, positioned in the HELIOS core. A Contextual Ego Network should represent the daily life of a user by representing the different context in which she/he lives. A single layer models a user's context. A context is a situation in which each user can find her/himself. A context can be described at this level by using three aspects: spatial aspect, temporal aspect and social aspect. The spatial aspect describes where the context happens, the temporal aspect describes when the context happens, and the social aspect describes with whom the context happens (which are the actors involved). Each context is local to its own user and asymmetrical with respect to analogous contexts of other users. From a purely mathematical point of view, a context can be described with a tuple C = (s, t, p), where s belongs to a spatial domain S, t belongs to a temporal domain T , and p belongs to a social domain P . Each of these domains is used to specify one of the three aspects defining a context: S for the spatial aspect, T for the temporal aspect, and P for the social aspect.
In our scenario, this is different because relationships amongst the members of the social network take place in different contexts. For this reason, a Contextual Ego Network cannot be easily modelled with classic complex network models.

CEN: a pillar multi-network structure
Multilayer networks [4,24] are a complex structure which can be used to describe our Contextual Ego Network. Indeed, they are useful to represent systems interconnected through different categories of connections. Each activity/context/category is represented by a layer and the same node can have different social interactions because each layer contains a set of neighbours. As described in [4], in a social network environment, we can consider different relationships: friendship, vicinity, coworker, etc., and different relationships can be modelled through multilayer networks.
Formally, a multilayer network is described in [4] as a pair δ = (η, π ) where η={G α ; α ∈ {1, . . . , M}} is a family of graphs (directed, undirected, weighted, or unweighted) G α =(X α , E α ), called layer of M, and π = {E αβ ⊆ X α × X β ; αβ ∈ {1, . . . , M}, α = β} is the set of interconnections between nodes of different layers. Several types of multilayer networks exist [4]. One of them is the multiplex network [13] a special type of multilayer network in which X 1 = X 2 = · · · = X M = X and the only possible type of interlayer connections are those in which a given node is only connected to its counterpart nodes in the rest of layers. In short, multiplex networks consist of a fixed set of nodes connected by different types of links. Multidimensional networks [3] are a mathematical model capturing multiple different relations that act at the same time. In a multidimensional network, a pair of entities may be linked by different kinds of links. Each possible type of relation between two entities is considered as a dimension of the network. In the case of a multidimensional network model, a network is a labelled multigraph, that is, a graph where both nodes and edges are labelled and where there can exist two or more edges between two nodes. Concerning Social Networks, a multilayer network is a useful structure which can model different actors and interactions on different contexts. We decided to use the Multi-Layer Model (ML-model) presented in [27] to formalize the Contextual Ego Network because the MLmodel can model the behaviour of users in different online social contexts, such as different Social Network accounts. In our case, the model should consider the decentralized scenario. In fact, the ML-model is a formal model able to represent the different contexts in which users are involved during their everyday online activity. The definition of a multi-layer model, as described in [27], is a weighted graph G = (V , E, w) where V is a set of vertices, E the set of edges and w is a weight that typically represents the strength of a relationship e in E. When we consider multiple layers, we need to know which nodes are included in more than one layer. This can be done by using a specific Node Mapping [27]. Having said that, a Contextual Ego Network can be defined by exploiting an instance of the multi-layer model, called Pillar multi-Network [27]. A Pillar multinetwork is characterized by |C(u)| ∈ {0, 1} and it represents a user as a pillar traversing every layer. The pillar multi-Network is helpful to implement our scenario. Indeed, it allows different nodes sets for each layer, and it provides a node mapping function between layers. Figure 3 shows a simple example in which the Contextual Ego Network is composed by three layers (contexts). Each layer is described by three variables, as mentioned previously, the location, the time, and the sociality expressed by the alters contained in the context. The three contexts express a common daily life scenario in which an ego node spends its daily time at work in the morning, then at the gym during the dinner break, and finally at home. An alter can be part of more than one context, as showed for example for the alter A1, which is part of the two layers: Work and Gym. Thanks to the node mapping function, we are able to represent this scenario and to know when the same node is part of one or more contexts.

Trust
From a computational perspective, the topic of trust has been an active area of research in recent years with mathematical models for trust becoming essential for decision making online. It should be noted that the concept of trust is an aggregated and multidimensional construct, built through repeated interaction between entities through time. Most types and bases of trust focus on an individual's decision to trust and on the process under which trust emerges. Thus, among a variety of factors, the relative importance of trust is dependent on the complexity and the context of action. Objects of trust furthermore might include the participants, the underlying technology (application), sites themselves. Measures of trust for users can include competence, ability, integrity honesty and compassion, all accounting for the intentions and behaviours of the actors. A trust value can represent different categories -systemtrust -based on perceived properties or reliance on the system (between organizational and institutional positions), interpersonal trust -agent is directly trusting another entity (within a context-specific environment), general attitudes of trust and trust in information resources related to the application of networks, information resources, software engineering, etc. The modelling of trust requires the accommodation of a constant context change as well as the need to appropriately evaluate the subjective value of trust given to each node through the different experiences of each node. Furthermore, the trust value would be always represented as incomplete due to the dynamic nature of the connections. Trust is also non-transitive and asymmetric, with the latter being that trust is not identical in both directions between two entities. For HELIOS, trust carries a multidimensional information about a certain relationship presented as a label of the relationship, turning trust values to highly context-dependent, meaning for each context and actors' interactions a different value of trust will be computed.
The trust value in HELIOS will consider, initially, the types and their values from the Table 2. A user, in this case, needs to utilize contextual information of the situation  Fig. 4 The CEN library as well as the available data to assign a trust measure. Importantly, at later stages of HELIOS, more measurement types can be added to the trust score in order to improve accuracy [22]. As such we evaluate a multidimensional situation -where trust has different values depending on the context. Since this is a constantly evolving value, it will be between 0 and 1, with the former representing the absence of trust and the latter being complete trust. Trust in HELIOS, based on the frequency and recency of the interactions, would decay by a certain factor. In HELIOS, if an alter is added to the ego network for the first time, it requires an initial computation of trust value. We will assign an initial small value of trust, for nodes to access minimally set of available information for each node. Moreover, with the small initial trust values we can begin the evaluation of the relation between two nodes. Then trust values can be evaluated based on the interaction of the nodes and therefore can decrease or increase.

CEN implementation
The core of a Social Network is the structure used to store and manage the social relationships. The Contextual Ego Network represents the principal component of the HELIOS Social Network. We provide an implementation of the CEN structure as a Java library, 10 which can easily be included in an Android application (Fig. 4). The principal classes are: -Edge. The class models a relationship between two users in a specific context. Each edge can have a weight, a direction, and a timestamp.
-Node. The class models the user as a node of the Contextual Ego Network. -Context. The class models the concept of context. -ContextualEgoNetwork. The class is a collection of Contexts. it provides an interface to create, store, and manipulate contexts, nodes, and edges.
As described in this paper, a context can have three different states: -Active. A context is stored in memory because it is currently used. -No Active. When the user change its social context, an active context is labelled as No Active and it is serialized in a file and stored in a persistence storage. -Current. A context can be modified when is considered as Current. Indeed, a user can have more than one Active contexts, but only one is set to Current.
The Context Detection process, which will be implemented by taking into account the description proposed in Section 4, is the main trigger for creating/managing a context. When the application, thanks to the Context Manager ( Fig. 1) retrieves an event concerning the detection of a context, it will check the ContextualEgoNetwork in order to establish whether the Context is created or it needs to be created. In the former case, the status of the specific context will be changed to Active (and Current), while in the latter case the context will be created and the status will be Active and Current.

Preliminary evaluation
Our preliminary evaluation concerns the need to have a multilayer social overlay. In particular, the CEN is able to represent the real life of a users and it represents a way to find similar contacts. We evaluate the homophily between the ego and the alters nodes added to the contexts. The dataset we used comes from a study carried on by the Stanford University on Facebook users. 11 The characteristics of the dataset are listed in Table 3. It is composed by 10 Ego Networks (EN). For each of them, it contains the following data: the number of nodes of the EN, having binary vectors of features as satellite data, the number of edges, and the so-called circles, which are used in the original work to describe subsets of the Ego Networks' nodes, aggregated based on a specific similarity criterion explained in [26]. In the framework of HELIOS, they can be seen as contexts of the CEN. Users' features deserve a more in-depth description. They are binary vectors attached to each node of the EN. Each of the vectors' entries is associated to a particular Facebook attribute that can be either present or not in a user's profile. The features are anonymized, so only the category they belong to can be derived from the dataset. For instance, the dataset may contain a feature 128 location;id;anonymized feature 128, that denotes a determined location where the a user may be at the moment or live in. Consider f i the binary vector of a certain user i, and f i j the j -th entry of user i's binary vector. We state that f i j = 1 if that particular feature is present on user i's profile. We decide to use the cosine similarity measure in order to evaluate the similarity between nodes. The measure is applied on pairs of nodes in each one of the circles, evaluating the average similarity between each alter and the ego, and the average similarity between pairs of alters of the same circle.
All the contexts, called feature contexts in this evaluation, are created by exploiting the same nodes and features of the dataset. For each ego network, we built n contexts, where n is the number of features set to 1 in the ego's feature vector. In particular, a user i belongs to a context originated from the feature c, in the ego network whose ego is the user e, if the following conditions are satisfied: 1. f i c = 1 2. The cosine similarity between f e and f i is greater than a certain α, namely sim(f e , f i ) ≥ α For our tests we decided to set α = 0.5.  6 show the evaluation of the similarity between Ego and alters (Fig. 5) and between the alters (Fig. 6), in the same context. In both figures, the xaxis refer to the Ego Networks while the y-axis contains the similarity values. With the exception of the first Ego Network which does not have matching features, and as a consequence it does not contain any users, both the average similarity with the ego and the overall average similarity are sharply higher in the feature contexts. Results show that our contexts guarantee a higher level of similarity compared with the approach presented in [26], where the similarity between users is obtained with an offline complex process. In particular, we focus our attention on Fig. 6, where the similarity is computed between the alters of a specific context. The high similarity values suggest that context can be easily used for prediction of social relationships. We can say that CEN provides meaningful relationships in an easy way, which is a main topic of HELIOS.

Conclusions and future work
This paper proposed the Contextual Ego Network, a new P2P social overlay proposed to model the real life of users. The Contextual Ego Network is part of the HELIOS project, a new Decentralized Social Network which takes advantage from the previous generation of DOSNs. We described in detail the concept of Context by introducing the problem of Proximity Detection, and we formalized the structure by taking into account the pillar multi-networks model. Finally, we proposed the CEN library, the Java implementation of the Contextual Ego Network, and a preliminary evaluation Fig. 6 Avg. similarity among alters in contexts which shows how the CEN creation guarantees a high similarity, which means meaningful relationships. We are planning to propose new mining algorithms which take into account the pillar structure, such as distributed graph neural network algorithms, in order to evaluate the behaviour of the users by considering their daily life expressed in the contexts. Furthermore, we plan to improve our preliminary evaluation of the CEN library by exploiting a real distributed scenario where the movement of nodes is simulated on a map.