## 1 Introduction  
In the last five years, activities related to Opportunistic networks (OppNets) have grown, attracting the attention of the scientific community [1]. This is due to the potential of these networks, which could become the solution to provide communication support in areas with overloaded cellular networks, and in scenarios where a fixed infrastructure is not available, like remote and developing regions. Nodes in OppNets exploit any connectivity that arises from node movements to distribute the contents, being largely based on the store-carry-forward mechanism derived from the delay and disruption-tolerant Networking (DTN) paradigm [2]. In OppNets, at every contact opportunity, the sender tries to send its messages to some relay nodes having a good probability of meeting their destinations at some other places [3]. However, since the path from a source to a destination is intermittently connected, the conventional routing algorithms are not applicable [4]. Consequently, new routing algorithms are required to overcome the long delays and frequent disconnection problems [5]. The traditional key challenge of a routing algorithm in an OppNet is to build a reliable path between a pair of nodes, enabling message exchanges between them. An efficient technique to achieve this aim is by selecting relay nodes with good chances to meet the destination in their next contacts. It is easy to realize that the better this selection is, the greater the chances of successfully delivering a message will be. Obviously increasing the delivery ratio means that the routing algorithm contributes to improving the network performance. Another important and essential key challenge of a routing algorithm is related to the detection of selfish nodes in real network scenarios. A node may autonomously decide whether to accept or not a custody transfer of an incoming message from another node and, consequently, node cooperation is not fully guaranteed and must not be taken for granted [6]. If the routing algorithm decides to forward a message to a selfish relay, the latter can refuse to receive it if the message destination is an unknown or unwanted node. Then, how should we proceed if the selected relay node is not willing to carry the message? With respect to selfishness, according to [7], nodes can be classified as socially or individually selfish. Basically, a node classified as individually selfish does not collaborate with any other node, which means that it does not accept messages from other nodes in the network. On the other hand, a node classified as socially selfish is willing to relay messages to the nodes within the same community, but it refuses to relay messages to the nodes outside its community [7]. Thus, these nodes will only relay messages for nodes with whom they have some social tie (friends or acquaintances). Thus, taking into account these assumptions, it is easy to realize that a better routing algorithm must be proposed by including the detection of selfish nodes and also finding out the set of nodes that are willing to collaborate with it. Having these premises in mind, in this work, we propose the \"FriendShip and Acquaintanceship Forwarding\" (FSF) algorithm, which makes its routing decisions taking into account the social ties between the nodes, and both the selfishness and the device resources' levels of the candidate node for message relaying. Firstly, to choose good relay nodes for a message, FSF uses the social ties between the nodes as a suitable criterion. The intuition behind this reasoning is that the stronger the social tie is between the nodes, the bigger the probability of meeting each other in the future will be. FSF divides the social ties between the nodes into three groups: their friends, their acquaintances, and unknown nodes. To discover the friendship between the nodes, FSF uses the self-report friendship information (if available), or a mechanism based on machine learning techniques.