LoCEC: Local Community-based Edge Classification in Large Online Social Networks

02/11/2020 ∙ by Chonggang Song, et al. ∙ National University of Singapore Tencent 0

Relationships in online social networks often imply social connections in the real world. An accurate understanding of relationship types benefits many applications, e.g. social advertising and recommendation. Some recent attempts have been proposed to classify user relationships into predefined types with the help of pre-labeled relationships or abundant interaction features on relationships. Unfortunately, both relationship feature data and label data are very sparse in real social platforms like WeChat, rendering existing methods inapplicable. In this paper, we present an in-depth analysis of WeChat relationships to identify the major challenges for the relationship classification task. To tackle the challenges, we propose a Local Community-based Edge Classification (LoCEC) framework that classifies user relationships in a social network into real-world social connection types. LoCEC enforces a three-phase processing, namely local community detection, community classification and relationship classification, to address the sparsity issue of relationship features and relationship labels. Moreover, LoCEC is designed to handle large-scale networks by allowing parallel and distributed processing. We conduct extensive experiments on the real-world WeChat network with hundreds of billions of edges to validate the effectiveness and efficiency of LoCEC.



There are no comments yet.


page 1

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

I Introduction

Understanding user relationship types benefits many social applications. An intuitive example would be social advertising [7, 5, 4, 24, 23]. When placing an advertisement for furniture and household items, it is best to select users that are family members with each other in order to boost online interaction as well as offline discussions of the product. Another example application is social recommendation [27]. Users tend to have more interest in news articles that are liked by their colleagues or games that are preferred by their schoolmates.

Identifying the classes of edges in social networks has been extensively studied in literature. The works in [17, 3, 26] focus on classifying edges as positive or negative, representing friends or enemies. Other works in [22, 6, 18] aim to identify a particular type of relationship such as advisor-advisee, employer-employee or romantic relationships. Recent works in [2, 1] formally define the edge classification problem in a general setting. A label propagation algorithm based on structural similarity is proposed in [2], which presumes a large proportion of edge labels are available in order to propagate true class labels to the entire network. However, in a real-world social network, only a small percentage of edge labels could be obtained, rendering the above technique inadequate. The work in [1] considers some edges are associated with textual content, such as communication history, and proposes a matrix-factorization algorithm to utilize both textual and structural information. However, in real-life social platforms, users tend to communicate with only a small ratio of friends. For example, in WeChat, around of user pairs have zero interactions over a month, making it difficult to extract user-to-user features for analysis. Furthermore, it is hard for the approach in [1] to process a network with hundreds of billions of edges since it requires to construct matrices whose columns represent all edges in the network.

In this work, we first carefully analyze how different types of user pairs interact on the WeChat platform and find useful interaction features for identifying relationship types. And then we summarize the major challenges in the edge classification task, which are data sparsity problem [9] and computation bottleneck in the billion-scale networks. To address such challenges, we present a Local Community-based Edge Classification (LoCEC) framework that works in three phases, namely division, aggregation and combination. In the division phase, we divide the entire network into ego networks where community detection is performed. Such communities are called local communities

since they only represent the friend circles around an ego node. In the aggregation phase, we classify the local communities based on the aggregated user interactions. A deep learning model CommCNN is proposed to classify local communities into major social connection types. In the combination phase, we jointly take the classification results of local communities in different ego networks to form a final relationship type for each edge in the entire network.

Figure 1 illustrates an intuitive example. If we extract the ego network of , we have , , , and as well as the edges among them. Note that ego node is not included in its own ego network. Next, we detect the local communities and . Afterwards, we classify the edges between the ego node and his friends based on the class label we assign to each local community. For example, if we want to identify the relationship type for edge , we classify based on the interactions between all user pairs in . Similarly, we extract ’s ego network and compute the label for the local community containing . Then the label of is determined by jointly considering the results from both and ’s ego networks.

Fig. 1: Example Network.

The contributions of this paper are as follows.

  • We present an in-depth analysis of how different types of user pairs interact on the WeChat platform and describe useful features for identifying relationship classes.

  • We propose the LoCEC framework for edge classification. LoCEC divides the network into small ego networks for distributed computations and adopts a community-based feature aggregation method to generate dense features for supervised learning tasks.

  • We develop a convolutional neural network-based algorithm, namely CommCNN, for effective community classification by considering structural information.

  • We perform rigorous experiments to validate the accuracy of LoCEC as well as its practical utility in social advertising. Both effectiveness and efficiency are evaluated using WeChat network with hundreds of billions of edges. To the best of our knowledge, this is the first work that studies edge classification problem at such large scale.

In the remaining, Section II gives a brief description of the WeChat social platform and present an analysis on social relationships. We formally define the relationship classification problem and gives an overview of LoCEC in Section III. The technical details of LoCEC are given in Section IV. Experimental studies are demonstrated in Section V. We review the related studies in Section VI and conclude our paper in Section VII.

Ii Preliminaries

In this section, we briefly introduce the WeChat social platform and conduct an in-depth study of how different types of users interact on WeChat.

Ii-a Background

WeChat is a large social mobile application with over one billion monthly active users. Users can form mutual friendships with other users by adding each other into their own contact lists. Other than messaging, WeChat offers a wide range of services such as chat groups and moments

. Groups are places for more than two users to communicate with each other instantly. Moments are timelines posted by users to share their latest status. Friends interact with each other by

liking or commenting on each other’s moments. Users can create their own timelines or re-post contents that are published by others. Users can also share mobile games in moments for their friends to join. Given such social features of WeChat, we next analyze how different types of user pairs interact with each other in multiple ways.

Ii-B Relationship Analysis

We conducted an analysis on user relationships to figure out (1) what the major relationship types are in the WeChat network and (2) what interaction features best indicate the relationship types. We first introduce how we obtain ground-truth relationship types and then we describe some findings based on the ground-truth data.

Ground-truth data. Users of different ages and genders are paid to participate in an online survey where they provide their chat group names and give the true relationship between their contacts. The identities of surveyed users and their contacts are fully anonymized. In the survey, users can select among family members, colleagues, schoolmates and others as first categories as well as thirteen second categories. The detailed design of relationship types is given in Table I. In this survey, users must assign a first category to a sampled friend and can decide on their own whether to specify a second category. If the second category is not specified, the relationship is marked as unknown. In total, we have collected relationships with ground-truth labels from users. Table I gives the ratio of each type of relationship. As can be seen, the major relationship types, namely family members, colleagues and schoolmates account for of all relationships. This indicates that WeChat is a social platform mostly for friends who know each other in the real world. Colleagues take up a large proportion () of relationships on WeChat. Other than the three major types, friends of similar interests form of the edges on WeChat. Due to privacy concern, users left of second category types unspecified. In this paper, we focus on the relationships of the three major categories, i.e. family members, colleagues and schoolmates.

First Category First Ratio Second Category Second Ratio
Family Members Next of kin
Colleagues Current
Schoolmates Primary
Others Interest
TABLE I: Relationship Types in User Surveys

Chat groups. Next we analyze group chats between different types of user pairs. Figure 2 gives the cumulative distribution of number of common groups between friends. As can be seen, more than of family member pairs share zero common groups. Most family members () share at most one group while schoolmates have slightly more common groups with more than share at least two groups. Colleagues have the largest number of common groups as more than of colleagues share less than three common groups. Group names are sometimes indicative of the relationships between group members. Class X in X Middle school or X Department in X Company imply schoolmates and colleagues respectively. We adopt a rule-based mining method to identify the relationship types of friend pairs within the same group by matching group names with specific patterns. Table II shows the results. As can be seen, group name-based methods could achieve rather high precision of over for all types. However, the recall is extremely low since the majority of groups do not have indicative names and around of friend pairs are not included in any common group. Clearly, we need to find a way to tackle the sparseness of informative common group names.

Fig. 2: Chat Group Analysis.
Relationship Type Precision Recall F1-score
Family Members 0.705 0.014 0.027
Colleague 0.821 0.005 0.01
Schoolmates 0.934 0.008 0.016
TABLE II: Group Name Classification Performance

Moments. Next we analyze user interactions in moments over thirty consecutive days. We study moments that fall into the following three categories: pictures, articles and games. Figure 3 shows the ratio of interacted family member/colleague/schoolmate pairs under a particular moment category over all family member/colleague/schoolmate pairs that have interacted under any moment category. We separately examine like and comment behaviors. As shown in Figure 3(a), different types of user pairs tend to like

pictures more than articles and games. Colleagues and schoolmates like articles more than family members and schoolmates have the highest probability of liking game posts. Figure

3(b) demonstrates how user pairs of different relationships comment on each others’ moments. As can be seen, all users tend to comment on pictures more than the other two categories. Colleagues have a very low chance of discussing games in moments and a rather high probability of commenting on shared articles. Family members and schoolmates mostly comment on pictures while over of schoolmates also talk under a game post. As demonstrated, different types of user pairs interact differently in moments, indicating user interaction features are useful in relationship classification. However, Figure 4 shows the cumulative distribution of user interactions and reveals that many user pairs have zero interactions in moments regardless of the relationship types. We are motivated to make use of the limited user interactions to generate features for most user pairs in the network.

(a) Like.
(b) Comment.
Fig. 3: Percentage of Interactions under Different Moment Types.
Fig. 4: Moments Analysis.

Solution discussion. As can be seen from above analysis, user interactions could be utilized as effective features for classifying edges. However, most user pairs do not have enough interactions or common groups to yield useful features. An intuition for this problem is that, features of user pairs that are of the same type could be aggregated together to generate more compact features. Now we analyze how to find user pairs of the same type without knowing their relationship types explicitly.

Figure 5 shows an ego network of a surveyed user. This network contains the ego user’s friends as well as the friendships between them. Note that the ego user is not included in the network. Each color represents a certain relationship type and small black nodes stand for the friends whose types are not specified. We observed two fact from the analysis shown in Figure 5. First, users that are closely connected with each other often have the same relationship type with the ego node. Second, friends of the same type could possibly be placed into multiple clusters in the network.

Fig. 5: Visualization of Labeled Friends.

Based on the above analysis, we know that

  • Family members, colleagues and schoolmates dominates the relationships on WeChat.

  • WeChat offers a wide range of social features like chat groups and moments. Users’ social behaviors could be used as features for classification but the behavioral data is very sparse.

  • Friends that are closely connected often share the same relationship type with each other. This finding could be used for aggregating user features in order to avoid feature sparseness.

Fig. 6: The LoCEC Framework.

Iii Problem Definition and Solution Overview

In this paper, we study the problem of classifying relationships in social networks into predefined social types.

Given a social network where is a set of nodes denoting the users and is a set of edges denoting the friend relationships. is the number of nodes in the network and is the number of edges in the network. User feature matrix gives the user features such as gender

etc. The feature vector of a node

is denoted as . User interactions are given by where is an matrix. For any edge , we have giving the number of times that and have interacted on the th dimension. In total, we have interaction dimensions including messaging, commenting, reposting or liking each other’s posts. As most of the real world social networks such as those from WeChat, Facebook and LinkedIn are undirected, we presume to be undirected in the rest of the paper.

Given a set of predefined labels , for each edge , there is an underlying label . We assume that each edge can only have one relationship type and edges with multiple types should be labeled by their principal types. Multi-type relationship mining is left as future work. Given a small set of edges with ground truth labels, the relationship classification problem can be formulated as a standard multi-label classification problem that predicts the correct label for all edges in .

In order to address the sparsity issue as well as handle billion-scale networks, we design a customized divide-and-combine method and propose Local Community-based Edge Classification (LoCEC) framework. Figure 6 gives an overview of the proposed method. LoCEC comprises a three-phase processing:

  • Phase I: Division. This is the local community detection phase where ego networks are extracted and community detection is performed. In this phase, for each node , we obtain the ego network of by extracting the neighbors of as well as the edges between nodes in .

  • Phase II: Aggregation. This is the community classification phase where user features are gathered together for classifying local communities into predefined relationship types. It consists of two stages, feature computation and community classification. Given a local community , for each , we aggregate ’s interactions with all members in to obtain ’s interaction feature vector . Then, we compute a tightness value between each node and local community to measure how closely connected is this node to the community. Next, we arrange the features of the top nodes with highest tightness values to form a feature matrix that is further fed to a prediction model. The output of community classification is given as a softmax vector .

  • Phase III: Combination. This is the edge classification phase where classification results of local communities are combined to form the final type label for each edge. In the last phase, for each edge , we concatenate community classification results and

    with tightness values to train a logistic regression model for predicting the relationship type of edge


Table III summarizes the frequently used notations in this paper.

Notation Meaning
Graph with node set and edge set .
Ego network of node .
The set of relationship type labels.
User feature matrix. User give row .
Length of users’ individual feature vector.
User interaction matrices .
Interaction of on dimension .
Local community .
Classification result vector for .
’s interaction features regarding community .
Number of rows in a feature matrix.
Feature vector for edge classification.
TABLE III: Summary of Notations

Iv Methodology

In this section, we describe the technical details of each phase in the LoCEC framework.

Iv-a Local Community Detection

In this phase, we partition the network into ego network for any . We define an ego network of user as the sub-graph around . Formally, is a sub-graph of where contains the the ego node ’s friends and . contains the edges between nodes in . We specifically use friends to refer to the users in except the ego user . Note that ego node and its adjacent edges are not included in its own ego network.

Next, we adopt the Girvan-Newman community detection algorithm (GN) [12] to detect local communities in the ego networks. Note that the ego node and his incident edges are not considered when computing communities. This is because the ego node is connected with each friend in the network. If the ego node is considered while detecting communities, the whole ego network is likely to be identified as one whole community.

Given a network depicted in Figure 7(a), Figure 7(b) illustrates the ego network of . is the ego node and the rest are ’s friends. Edges among the ego node’s friends are kept in the ego network while edges incident with are not kept (depicted in dashed lines). Figure 7(c) illustrates the local communities detected in , namely and . Note that is not considered in the community detection process and hence it is not included in either or .

(a) Example Network .
(b) Ego Network .
(c) Local Communities in
Fig. 7: Illustration of LoCEC Phase I: Division

Iv-B Local Community Classification

Given the local communities in each node’s ego network, we train a classification model to label each local community as one of the predefined social types. In this phase, we first construct a feature matrix that represents each local community. Then, the feature matrix is fed into a prediction model for training a classifier. The details of Phase II are described in the following.

Iv-B1 Feature Matrix Computation

Community feature matrix consists of feature vectors of users in this community. Given a community and , the user feature consists of two parts. The first part contains users’ individual attributes such as gender. The second part includes user ’s interaction behaviors with other users in such as liking or commenting each other’s posts.

For a user , individual features of are given as a feature vector . Note that describes the basic attributes of and is independent of the local community that belongs to. The interaction data between two connected users is given by where is the number of dimensions that we observe user interactions. We now describe how we aggregate interaction features between user pairs to form the feature vector .

Given a friend in a local community , we compute the feature value of the th interaction dimension as follows:


where .

Note that even if the interaction between the ego node and a friend may be sparse or empty, Equation 1 aggregates the interactions between this friend and all members in the local community to compute his feature value. The function evaluates how this friend interacts with all members in the same local community.

Then, the interaction feature vector for node with respect to local community is given as


To arrange the feature vectors in a matrix, members in local communities need to be placed in an ordered sequence of fixed length. We define tightness values between each node and its belonged local community to sort the community members. The intuition is, nodes that are connected with more nodes in the same local community and fewer nodes in other local communities should play more important roles in representing this community and have higher tightness values. Formally, given the ego node and his friend in a local community , let be the ego network of and be the local community containing , the tightness of a node is defined as


where is the number of nodes in community and gives the number of friends that connects with in local community . Similarly, gives the number of friends that have in ’s ego network. In a special case where only one node is in the local community, its tightness is set to .

See local community in Figure 7(c) as an example. For and , since they are connected with all other nodes in and have zero connection outside except the ego node, their tightness to is computed as

However for , its tightness to is

since it is connected with that is not in .

Next, we take the user features as well as interaction features of the top users with the highest tightness values to form a matrix as the feature matrix of a local community. This feature matrix serves as the feature representation for each local community in subsequent classification tasks.

Algorithm 1 gives the details of feature matrix construction. For each node in a local community, lines 3 to 5 compute its feature vector while lines 6 and 7 decide its position in the final feature matrix. Lines 9 to 11 takes the top users with the highest tightness values in the local community to form the final feature matrix of the community. Algorithm 1 is repeated for each local community in each ego network.

input : 1. Local community
2. User feature matrix
3. User interaction matrices
output : Local community ’s feature matrix
1 Initialize maximum heap ;
2 foreach  do
3       for  do
4            Compute with Equation 1;
5      Compute with Equation 2;
6       Compute with Equation 3;
7       Insert into with value
8Initialize to an empty matrix;
9 for  do
10       Pop with the largest value in ;
11       Append to ;
Return ;
Algorithm 1 Feature Matrix Construction

Iv-B2 Community Classification Model

We now discuss the choices of classification models given the feature matrix representation of local communities.

XGBoost.XGBoost [10]

is a popular gradient boosting framework for solving industrial machine learning problems. Since XGBoost takes feature vectors instead of matrices, we compute the mean and standard deviation of each feature dimension regarding all nodes in a local community to form the feature vector of a community. XGBoost decides the class label for each local community.

Even though XGBoost is simple and effective, taking the mean and deviation reduces the information contained in the feature matrix. Hence, we seek to design a more comprehensive model for community classification.

CommCNN. Graph Convolutional Networks (GCN) [15, 25] have recently been proposed to handle embedding tasks on network data. GCN allows features on each node to be propagated via convolutional kernels to generate embedding for individual nodes as well as graphs. However, since each community has its own structure, GCN requires a training process for each community which is infeasible in our circumstance. Next, we develop a convolutional neural networks-based prediction model named CommCNN for community classification. In the following, we introduce the details of CommCNN.

CommCNN takes a feature matrix as input and matrices with less than

rows are padded with zeros. We process the matrix with three types of convolutional kernels. The first convolutional kernel is a popular

square kernel

where adjacent rows and columns are considered. This kernel design is widely adopted in computer vision problems such as object detection 

[11]. However, unlike image matrices where feature positions are fixed, our feature columns are ordered randomly. Hence we introduce two additional kernels, namely the wide kernel and the long kernel:

The wide kernel is of size that looks at all features of the same node as a whole such that all feature attributes of the same user can be compared together. The long kernel is of size in order to compare the values of all nodes in each feature dimension.

The design of CommCNN is given in Figure 8. We have three types of convolution kernels, namely square, wide and long. Wide and long convolutions are followed by a convolution and a global max pooling layer while the square convolution layer is followed by two Square Convolution Modules, consisting of a

convolution layer and a max pooling layer, to abstract the features to a deeper level. To summarize, the

Convolution Model in Figure 8 consists 3 layers in wide and long convolutions and 7 layers in square convolutions. The output of Convolution Model is sent to two fully connected layers and a softmax function at the end.

The output of CommCNN model is a vector of length where is the set of relationship types. Each dimension in the output vector gives the probability of the input community belonging to a particular relationship type.

Fig. 8: CommCNN Model.

Iv-C Edge Labeling

Given the classification results of local communities, we now proceed to decide the relationship types of all edges. For an edge , we look at the local community that belongs to in ’s ego network as well as the local community that resides in ’s ego network. Intuitively, if these two local communities are classified as the same social type, then is labeled as this particular relationship type.

Consider our running example in Figure 1, Figure 9 shows the local communities in and ’s ego networks. Assume that we wish to decide the relationship label of edge . We compare the social type of and , which are and . If , we label as .

(a) ’s local communities.
(b) ’s local communities.
Fig. 9: Local communities of and .

However, in the above example, and may not be labeled as the same type, i.e. . To solve such cases, we design a supervised learning approach to effectively combine the classification results of local communities computed in individual users’ ego networks. Specifically, we utilize a logistic regression (LR) model [19] as a multi-label classifier to predict the edge label for each edge.

We now describe how to compute the features for each edge. For an edge , assuming is the local community in ’s ego network that resides in and is the local community in ’s ego network that resides in.

For XGBoost, classification result vectors and are constructed by concatenating the values of the leaf nodes on the final layers of generated trees for classifying and respectively [16].

For CommCNN, given an edge , gives probability of being classified as type for and gives the probability of being classified as type . is the set of social labels. We have and .

In addition, we also need to consider how close and belong to their own local communities in order to decide the relationship type on edge . Hence, we include the tightness values of each node in his corresponding community as well as the community classification results produced by in Phase II to form the feature vector of an edge :


where the tightness function is defined in Equation 3.

Given the feature vectors, we train a logistic regression model to predict the relationship type of each edge. Recall that edge features are rather sparse in the original dataset. After the divide-aggregate-combine process in previous phases, each edge is guaranteed to have a dense feature vector that can be used for classification.

Algorithm 2 gives the overall computation procedure of LoCEC. Lines 1 to 4 divide the entire network into small ego networks and line 5 computes the classification result for local communities detected in ego networks. In order to decide the relationship type for each edge, lines 6 and 7 combine the classification result for local communities as well as tightness values to form a feature vector that is further fed to a classifier for prediction. Line 8 returns the predicted label for each edge.

input : 1. Network
2. User feature matrix
3. User interaction matrices
output : Relationship type for each edge
1 foreach  do
2      Compute set of local communities ;
3       foreach  do
4            Compute feature matrix for with Algorithm 1;
5             Predict ’s classification result with XGBoost or CommCNN;
8foreach  do
9       Compute with Equation 4;
10       Predict relationship type using LR algorithm;
11       Return predicted relationship type for ;
Algorithm 2 The LoCEC Algorithm

V Experiments

In this section, we present the experimental studies on the WeChat network. All experiments are carried out on Linux servers with 2 Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz CPU and 128GB ram.

Datasets. The ground truth datasets are collected via user surveys as introduced in Section II. We test our methods with ground-truth data as well as the WeChat network with hundreds of billions of edges. Individual features include user attributes that users upload to their public profiles including gender etc. Interaction features include users’ social interactions with friends on public platforms, such as liking or commenting each other’s posts.

Comparative methods. We compare the following methods in our experiments:

  • ProbWP [2]. This is a label propagation algorithm that utilizes min-hash functions to compute edge similarity for propagation. The number of min-hash functions is set to as indicated in [2].

  • Economix [1]. This approach adopts a matrix-factorization algorithm to utilize both textual and structural information. In [1], textual content refers to the communication history between two users. We consider each interaction together with the number of interaction times as a word in order to apply the Economix model since users’ communication histories cannot be obtained.

  • XGBoost [10]

    . We train a gradient boosted decision tree (GBDT) model to classify the edges. The input feature consists of the individual features of two end users and the interaction feature between them.

  • LoCEC-XGB. This is the proposed LoCEC framework using XGBoost as community classification algorithm. We use a statistical method to aggregate the features of all nodes in a local community to generate the feature vector for training. Specifically, we compute the mean and standard deviation of each feature dimension regarding all nodes in a local community to form the feature vector of a community. Values of leaf nodes are considered as community embedding for predicting edge labels.

  • LoCEC-CNN. This is the proposed LoCEC framework using CommCNN, proposed in IV, for community classification. CommCNN model has three types of convolution kernels to abstract the feature matrix and train a classifier to decide the type of each community. Then the edge label is determined with a logistic regression model taking into consideration the local communities’ type distribution as well as end nodes’ tightness values.

Evaluation Metric. As F1-score [13] is widely adopted in literature to evaluate multi-label classification techniques, we employ the same metric in our experiments. We also report the effectiveness of utilizing edge classification results in social advertising.

V-a Parameter Study

Recall that, for CommCNN, we use a parameter to decide the number of users whose features are organized into the feature matrix. For local communities with more than users, we consider the top nodes with highest tightness values. For local communities with less than users, we adopt zero-padding to fill up the spare rows.

To determine the optimal choice of , we firstly observe the cumulative distribution of all local communities’ sizes. Figure 10(a) gives the details. As can be seen, the median size of all communities is . Around of all local communities have no more than users and of the local communities have less than users. We conduct a preliminary study of by varying from to ..

(a) CDF of Community Size.
(b) Performance as Varies.
Fig. 10: Parameter Study.

As can be seen in Figure 10(b), when is small, the overall F1-score is low since there is not enough information for LoCEC-CNN to learn. The performance peaks at and then drops as increases. This is because when is too big, many feature matrices need to be padded with many zero rows, introducing unwanted noise to the model. Hence in all our experiments, we set for LoCEC-CNN. Note that LoCEC-XGB does not depend on since it uses mean and deviation to aggregate user features. The baseline methods do not utilize community structure and hence are irrelevant of .

V-B Relationship Classification Performance

In this part, we compare proposed methods in terms of edge classification accuracy.

Effectiveness study. In total, covers edges, which account for around of edges in WeChat. To compare with label propagation algorithms, we extract a sub-graph by extending from surveyed users to their friends and make sure around of edges are given ground truth labels. Note that the identities of surveyed users’ friends are fully anonymized. In particular, this sub-graph contains nodes and million edges. In this set of experiments, we split of labeled edges into training set and into test set.

Algorithm Community Type Precision Recall F1-score
ProbWP Colleague 0.804 0.778 0.791
Family Members 0.787 0.776 0.782
Schoolmates 0.820 0.803 0.811
Overall 0.805 0.782 0.793
Economix Colleague 0.744 0.736 0.740
Family Members 0.702 0.767 0.733
Schoolmates 0.767 0.806 0.786
Overall 0.747 0.762 0.754
XGBoost Colleague 0.714 0.673 0.693
Family Members 0.747 0.615 0.675
Schoolmates 0.692 0.613 0.650
Overall 0.720 0.633 0.674
LoCEC-XGB Colleague 0.754 0.862 0.804
Family Members 0.870 0.875 0.872
Schoolmates 0.852 0.866 0.859
Overall 0.830 0.871 0.850
LoCEC-CNN Colleague 0.866 0.875 0.870
Family Members 0.935 0.952 0.943
Schoolmates 0.890 0.933 0.911
Overall 0.902 0.931 0.916
TABLE IV: Relationship Classification Performance
(a) Colleagues.
(b) Family Members.
(c) Schoolmates.
(d) Overall.
Fig. 11: Performance of Edge Classification.

Table IV gives the detailed results for relationship classification. ProbWP utilizes a propagation-based approach for edge labeling and achieves an F1-score of . Based on our analysis in Section II, in WeChat, closely connected users are often linked by edges of the same relationship type, allowing ProbWP to be rather effective considering structural information alone. XGBoost method directly uses user features to train a classifier and has the lowest F1-scores since many user pairs lack interaction data, resulting in bad performance in recall. Economix performs better than XGBoost as it also utilizes structural information for propagating edge labels. Both LoCEC-XGB and LoCEC-CNN use the local community structure to aggregate features for predicting edge labels to avoid sparsity problem. LoCEC-CNN performs the best with in F1-score and LoCEC-XGB is a close runner up with in F1-score. This shows that the CommCNN model is more effective in aggregating features than taking means and deviations.

Varying ground truth percentage. In the previous experiment, a sub-graph with of edges are given ground-truth labels. In this set of experiments, we vary the percentage of labeled edges from to (out of the of labeled edges) and report the performance of different algorithms in deciding the rest of the edges’ types. Note that we only evaluate the labels predicted for edges whose ground truth types are known. Figure 11 gives the results.

As can be seen, LoCEC-CNN constantly outperforms all baseline methods in terms of F1-score. Runner up algorithm is LoCEC-XGB since it also utilizes local community to aggregate user features. When the percentage of ground truth labels is , label propagation algorithms ProbWP performs poorly with an F1-score less than , while supervised learning algorithms perform much better. As more labeled edges are given, the performance of ProbWP increases significantly. From the user surveys, only of edge labels are obtained in the WeChat network, label propagation algorithms are not applicable. Economix’s performance also increases as more labels are given since it also utilizes structural information for propagating labels. When a small percentage of edge labels are given, Economix gives better results by considering user interactions. Note that XGBoost algorithm performs better than label propagation algorithm when only to of ground truth labels are given. However, ProbWP and Economix achieve higher accuracy than XGBoost when of edge labels are visible. This is because, ProbWP relies heavily on given labels in determining labels for new edges while Economix uses matrix factorization to propagate labels to similar nodes. On the other hand, XGBoost suffers from the feature sparsity problem which cannot be solved by adding samples.

V-C Community Classification Performance

We now examine the performance of LoCEC-XGB and LoCEC-CNN in classifying local communities. Note that label propagation-based algorithms ProbWP and Economix as well as XGBoost are omitted here since they mainly focus on classifying edges instead of communities. In this experiment, we extract the ego networks of all surveyed users and detect local communities using Girvan-Newman [12] algorithm. Then, the ground-truth label of a community is determined by the majority type of friends with ground-truth relationship classes. We have around thousand local communities with ground-truth labels, indicating they are colleagues, family members or schoolmates. We split of these labeled communities into training set and into test set.

Algorithm Community Type Precision Recall F1-score
LoCEC-XGB Colleague 0.808 0.887 0.845
Family Members 0.892 0.914 0.903
Schoolmates 0.884 0.889 0.886
Overall 0.863 0.900 0.882
LoCEC-CNN Colleague 0.879 0.903 0.891
Family Members 0.941 0.967 0.953
Schoolmates 0.901 0.944 0.920
Overall 0.914 0.940 0.927
TABLE V: Relationship Classification Performance

Table V gives the evaluation results of local community classification. As can be seen in Table V, LoCEC-CNN gives the better overall performance with in F1-score. It improves LoCEC-XGB by with a transformed CNN model. Note that the F1-scores of edge classification are slightly lower than those of community classification. We believe this is due to the impurity of community detection results. Consider an example scenario where all colleagues connect with a tour guide in a team building trip. The tour guide is placed in a local community where most of its members are colleagues of each other. Hence this particular local community will be labeled as colleagues in the ground truth. When LoCEC-XGB and LoCEC-CNN classify this particular local community as colleagues, it is a true positive. However, when the algorithms try to label the edges between the tour guide and the colleagues, it is hard for the classifier to make a correct decision. Hence, we argue it is also important to distinguish the impurity in detected local communities and we leave this as future work.

V-D Scalability Study

We now discuss the scalability of our proposed frameworks. Since LoCEC-CNN is more effective than LoCEC-XGB and they share the same computation framework, we only apply LoCEC-CNN on the entire WeChat network for scalability study.

Method Training Phase I Phase II Phase III Total
LoCEC-CNN 4.5 46.5 15.3 7.4 73.7
TABLE VI: Running Time (hours) of LoCEC-CNN

Table VI gives the running hours of LoCEC-CNN taking the entire WeChat network as input. Note that CommCNN model is trained beforehand and it takes 4.5 hours. We report the averaged results over three runs using Linux servers with the same CommCNN model. Phase I consumes the highest amount of time (around two days) to detect local communities while Phase II together with Phase III take one day to finish for community and edge classification.

Figure 12 analyzes the scalability of LoCEC-CNN given different input sizes and computation resources. Figure 12(a) gives the running hours of the different phases when we increase the number of input nodes from 100 million to 1 billion. As can be seen, the running time increases linearly as the number of input nodes grows. Figure 12(b) shows the running time for LoCEC-CNN to process the entire WeChat network by varying the computation resources. As demonstrated, when the number of servers used for computation increases, the computation time decreases accordingly. This is because, in the LoCEC framework, each node is parsed separately in a streaming scheme in all three phases. This set of experiments show that LoCEC is highly scalable and capable of processing large real world social networks.

(a) Run time VS Node Number.
(b) Run time VS Server Number.
Fig. 12: Scalability Study.

V-E Application of Edge Classification Results

In total, LoCEC-CNN classified billion local communities as well as billion edges into predefined social types. The distribution of predicted community types and relationship types are given in Figure 13. As can be seen, family members and colleagues take up the majority of our social circles with schoolmates account for around of our friends on WeChat. We notice in the community type distribution, the percentage of family members and colleagues are and respectively. However in the relationship type distribution, family members and colleagues account for and respectively. This is because, the size of family communities are much smaller than that of colleague communities. This is unanimous with our intuition that the social circle in the working environment is often bigger than our families.

(a) Community.
(b) Relationship.
Fig. 13: Distribution of Community and Relationship Types.
(a) Click Rate.
(b) Interact Rate.
Fig. 14: Performance in Social Advertising.

The results of LoCEC-CNN are deployed in many applications in WeChat such as social advertising in Moments. Advertisements in WeChat Moments are displayed the same way as users’ timelines. Friends can see each other’s like or comment under the same advertisement. They can also interact with other friends by replying to their friends’ comments. Ad owners provide a set of seed users that are known to be interested in the product.

Here we compare two approaches. Relation method chooses the friends of seed users while LoCEC-CNN selects friends of a specific type. The same click-through-rate (CTR) scoring function is adopted by both Relation and LoCEC-CNN and the friends with the highest scores are returned. Note that furniture ads are more popular among family members while mobile game ads attract more interaction among schoolmates.

Figure 14 shows the results. LoCEC-CNN reaches higher click rate when compared with simply choosing high-score friends. This is because, intuitively, users tend to pay more attention to the furniture that their family members have liked. Similarly, schoolmates are more likely to be interested in gaming apps that their friends have talked about. The advantage of LoCEC-CNN is even more obvious when we consider the interact rate in Figure 14(b). Interactions are strong indications of a user being interested in the advertised product and LoCEC-CNN boosts interaction rate more than twice of Relation. Clearly, the results generated by LoCEC-CNN are highly valuable in social applications.

Vi Related Work

While most existing studies on graph classification focus on nodes [8, 28, 29], there is some recent research interest in classifying relationships in online social networks. Some studies work on classifying edges as friends and enemies [3, 17, 20, 26, 14]. They analyze network topology and employ link prediction methods to identify edges with positive or negative signs. The work in [26] also utilizes a behavior relation interplay model that studies behavioral evidence to infer social interactions. However, our work is not to infer the sentiment of social connections but rather the true underlying social relations. Other works in [6, 22, 18] focus on a particular domain of relationships. Wang et. al. [22] propose a supervised probabilistic model to classify connections into adviser-advisee relationships in a publication network. Backstrom et. al. [6] study the dispersion of a pair of users’ social circles to identify romantic relationships. Li et. al. [18] adopt a label propagation algorithm for identifying user attributes as well as employer-employee relationships in a work place. Tang et. al. [21] utilize a semi-supervised approach to infer edge types relying on available data in a particular domain and correlation factors of networks. The above mentioned methods require domain-specific insight of the network or relationships since they are tailored for a classification problem under specialized assumptions. However in this paper, we aim to solve the relationship classification problem in a more general setting where all major social relation types could be considered.

The work in [2] was the first to formally study the problem of edge classification in networks. They consider a large percentage of relationships have ground-truth labels. They define a structural similarity measure based on the proportion of neighbors that share the same ground-truth label. For an unlabeled edge , they look for the top- nodes that are most structurally similar to , denoted as and repeat the same step for node , obtaining . Then the dominant class label of labeled edges with one end in and another end in is assigned as the edge label for . Their approach relies heavily on the number of labeled edges. As shown in the experiments in [2], there is a significant drop in accuracy when the percentage of unlabeled edges increases from to . However, in a real-life social network like WeChat, the percentage of unlabeled relationship is up to , rendering their approach inapplicable. Furthermore, Aggarwal et. al. [1] extend their method to consider text associated with user relationships such as communication history. They propose a matrix factorization-based algorithm to utilize both textual and structural information by treating each relationship as a document with words. In this work, we aim to utilize user interactions instead of communication histories as relationship features and propose a local community-based approach to handle the sparsity problem.

Vii Conclusion

In this paper, we study the problem of relationship classification in large online social networks. We carry out an in-depth analysis of user relationships on WeChat platform. Based on findings from the analysis, we propose a local community-based edge classification (LoCEC) framework to tackle the sparsity and scalability challenges. We design a CommCNN model to classify local communities into predefined social types and use a logistic regression model to further expand the community types onto edges. Experiments have been conducted to prove the proposed approach is effective and scalable. We believe this is the first work that systematically solves the edge classification problem in a real-life billion-scale network.


We would like to thank Lingling Yi and Hao Gu for sharing the ground-truth data obtained from user surveys. We would also like to thank the anonymous reviewers for their valuable comments and constructive suggestions that helped improve the paper. Qian Lin is supported by Singapore Ministry of Education Academic Research Fund Tier 3 under MOE’s official grant number MOE2017-T3-1-007.


  • [1] C. C. Aggarwal, Y. Li, P. S. Yu, and Y. Zhao (2017) On edge classification in networks with structure and content. In Proceedings of the International Conference on Data Engineering (ICDE), pp. . Cited by: §I, 2nd item, §VI.
  • [2] C. Aggarwal, G. He, and P. Zhao (2016) Edge classification in networks. In Proceedings of the International Conference on Data Engineering (ICDE), pp. . Cited by: §I, 1st item, §VI.
  • [3] P. Agrawal, V. K. Garg, and R. Narayanam (2013) Link label prediction in signed social networks. In

    Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI)

    pp. . Cited by: §I, §VI.
  • [4] C. Aslay, F. Bonchi, L. V. S. Lakshmanan, and W. Lu (2017) Revenue maximization in incentivized social advertising. Proceedings of the VLDB Endowment (PVLDB) 10 (11), pp. 1238–1249. Cited by: §I.
  • [5] C. Aslay, L. V.S. Lakshmanan, W. Lu, and X. Xiao (2018) Influence maximization in online social networks. In Proceedings of the ACM International Conference on Web Search and Data Mining (WSDM), pp. . Cited by: §I.
  • [6] L. Backstrom and J. Kleinberg (2014) Romantic partnerships and the dispersion of social ties: a network analysis of relationship status on facebook. In Proceedings of the ACM Conference on Computer Supported Cooperative Work & Social Computing, pp. . Cited by: §I, §VI.
  • [7] E. Bakshy, D. Eckles, R. Yan, and I. Rosenn (2012) Social influence in social advertising: evidence from field experiments. In Proceedings of the ACM Conference on Electronic Commerce (EC), pp. . Cited by: §I.
  • [8] M. Bilgic and L. Getoor (2008) Effective label acquisition for collective classification. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pp. . Cited by: §VI.
  • [9] S. Cai, G. Chen, B. C. Ooi, and J. Gao (2019) Model slicing for supporting complex analytics with elastic inference cost and resource constraints. Proceedings of the VLDB Endowment (PVLDB) 13 (2), pp. 86–99. Cited by: §I.
  • [10] T. Chen and C. Guestrin (2016) XGBoost: a scalable tree boosting system. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pp. . Cited by: §IV-B2, 3rd item.
  • [11] R. Girshick (2015) Fast r-cnn. In Proceedings of the International Conference on Computer Vision (ICCV), pp. . Cited by: §IV-B2.
  • [12] M. Girvan and M. E. J. Newman (2002) Community structure in social and biological networks. Proceedings of the National Academy of Sciences 99 (12), pp. 7821–7826. Cited by: §IV-A, §V-C.
  • [13] C. Goutte and E. Gaussier (2005)

    A probabilistic interpretation of precision, recall and f-score, with implication for evaluation

    In Proceedings of the European Conference on Advances in Information Retrieval Research (ECIR), pp. . Cited by: §V.
  • [14] M. Gupta and R. Mishra (2017) Prediction of binary labels for edges in signed networks: a random-walk based approach. In Proceedings of the International Computer Science and Engineering Conference (ICSEC), pp. . Cited by: §VI.
  • [15] W. L. Hamilton, R. Ying, and J. Leskovec (2017) Inductive representation learning on large graphs. In Proceedings of the Annual Conference on Neural Information Processing Systems (NIPS), pp. . Cited by: §IV-B2.
  • [16] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and et al. (2014) Practical lessons from predicting clicks on ads at facebook. In Proceedings of the International Workshop on Data Mining for Online Advertising (ADKDD), pp. . Cited by: §IV-C.
  • [17] J. Leskovec, D. Huttenlocher, and J. Kleinberg (2010) Predicting positive and negative links in online social networks. In Proceedings of the International Conference on World Wide Web (WWW), pp. . Cited by: §I, §VI.
  • [18] R. Li, C. Wang, and K. C. Chang (2014) User profiling in an ego network: co-profiling attributes and relationships. In Proceedings of the International Conference on World Wide Web (WWW), pp. . Cited by: §I, §VI.
  • [19] C. J. Peng, K. L. Lee, and G. M. Ingersoll (2002)

    An introduction to logistic regression analysis and reporting

    Journal of Educational Research 96 (1), pp. 3–14. Cited by: §IV-C.
  • [20] X. Song, C. Lin, B. L. Tseng, and M. Sun (2005) Modeling and predicting personal information dissemination behavior. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pp. . Cited by: §VI.
  • [21] W. Tang, H. Zhuang, and J. Tang (2011) Learning to infer social ties in large networks. In Proceedings of the European Conference on Machine Learning and Knowledge Discovery in Databases, pp. . Cited by: §VI.
  • [22] C. Wang, J. Han, Y. Jia, J. Tang, D. Zhang, Y. Yu, and J. Guo (2010) Mining advisor-advisee relationships from research publication networks. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pp. . Cited by: §I, §VI.
  • [23] W. Wang, M. Zhang, G. Chen, H. V. Jagadish, B. C. Ooi, and K. Tan (2016) Database meets deep learning: challenges and opportunities. ACM SIGMOD Record 45 (2), pp. 17–22. Cited by: §I.
  • [24] Y. Wang, Q. Fan, Y. Li, and K. Tan (2017) Real-time influence maximization on dynamic social streams. Proceedings of the VLDB Endowment (PVLDB) 10 (7), pp. 805–816. Cited by: §I.
  • [25] Z. Wu, S. Pan, F. Chen, G. Long, C. Zhang, and P. S. Yu (2019) A comprehensive survey on graph neural networks. arXiv preprint arXiv:1901.00596. Cited by: §IV-B2.
  • [26] S. Yang, A. J. Smola, B. Long, H. Zha, and Y. Chang (2012) Friend or frenemy? predicting signed ties in social networks. In Proceedings of the International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR), pp. . Cited by: §I, §VI.
  • [27] Q. Zhang, J. Wu, H. Yang, W. Lu, G. Long, and C. Zhang (2016) Global and local influence-based social recommendation. In Proceedings of the ACM International Conference on Information & Knowledge Management (CIKM), pp. . Cited by: §I.
  • [28] D. Zhou, J. Huang, and B. Schölkopf (2005) Learning from labeled and unlabeled data on a directed graph. In Proceedings of the International Conference on Machine Learning (ICML), pp. . Cited by: §VI.
  • [29] X. Zhu, Z. Ghahramani, and J. Lafferty (2003) Semi-supervised learning using gaussian fields and harmonic functions. In Proceedings of the International Conference on Machine Learning (ICML), pp. . Cited by: §VI.