自我中心网络

您所在的位置:网站首页 社交网络定义是什么 自我中心网络

自我中心网络

2024-07-07 00:07| 来源: 网络整理| 查看: 265

一、ego network的概念和定义

当不研究网络的整体,而是侧重于研究单个节点的性质,就会用到ego network。ego network是整体网络结构的一部分,是给定某节点,通过广度优先搜索遍历搜索出的网络结构。

ego Network: 又称自我中心网络,网络节点由唯一的一个中心节点(ego),以及这个节点的邻居(alters)组成,边只包括ego与alter之间,以及alter与alter之间的边。

以社交网络为例,针对某个人而言,将此人以及其朋友看作是节点,只考虑这个人和他朋友,以及他朋友之间的连边,就可以得到一个以A为中心的网络,即自我中心网络。如下图:

图1. ego示例

图中每个alter和它自身的邻居构成一个ego network,所有节点的ego network合并起来,就可以组成真实的的social network了。假设全图如下:

图2. 全图示例 以节点1为中心的ego network为: 图3. 以节点1为中心的ego network 三、ego network的提取特征

基于ego network可以提取与业务相关的网络属性特征。表格来源于文献:Thomas Zimmermann et al. Predicting Defects using Network Analysis on Dependency Graphs;

图4. "Predicting defects using network analysis on dependency graphs" 图5. Ego network相关网络特征属性 Size of ego network: the number of nodes that one-step out neighbors of ego, plus ego itself. Number of directed ties: the number of connections among all the nodes in the ego network; Number of ordered pairs: the number of possible directed ties in each ego network; Density: the number of ties divided by the number of pair; Average geodesic distance : the mean of the shortest path lengths among all connected pairs in the ego network.; Diameter of an ego network: the length of the longest path between connected actors (just as it is for any network). Number of weak components.: A weak component is the largest number of actors who are connected, disregarding the direction of the ties ; If ego was connected to A and B (who are connected to one another), and ego is connected to C and D (who are connected to one another), but A and B are not connected in any way to C and D (except by way of everyone being connected to ego) then there would be two "weak components" in ego's neighborhood. Number of weak components divided by size: normalize the count of components by size. Two-step reach: goes beyond ego's one-step neighborhood to report the percentage of all actors in the whole network that are within two directed steps of ego. (2-hop connection); Reach efficiency (two-step reach divided by size) : norms the two-step reach by dividing it by size. Brokerage (number of pairs not directly connected): The idea of brokerage (more on this, below) is that ego is the "go-between" for pairs of other actors. In an ego network, ego is connected to every other actor (by definition). If these others are not connected directly to one another, ego may be a "broker" ego falls on a the paths between the others. Normalized brokerage (brokerage divided by number of pairs) : assesses the extent to which ego's role is that of broker. Betweenness: ego is "between" two other actors if ego lies on the shortest directed path from one to the other. The ego betweenness measure indexes the percentage of all geodesic paths from neighbor to neighbor that pass through ego. Normalized Betweenness : compares the actual betweenness of ego to the maximum possible betweenness in neighborhood of the size and connectivity of ego's. The "maximum" value for betweenness would be achieved where ego is the center of a "star" network; -EI-index: Ego-Alter Homophily; 四、如何实现ego network的提取

随机选取图节点中任意一个作为种子节点,采用广度优先搜索的方式(走有限步数)获得该节点的Ego network。该部分内容将展示如何用R语言实现ego network的提取和指标分析。主要涉及的R包为igaph和egor包

1. igraph包生成ego network

使用方法:

ego_size(graph, order = 1, nodes = V(graph), mode = c("all", "out", "in"), mindist = 0) ego(graph, order = 1, nodes = V(graph), mode = c("all", "out", "in"), mindist = 0) make_ego_graph(graph, order = 1, nodes = V(graph), mode = c("all", "out", "in"), mindist = 0)

参数说明:

graph:The input graph. order: Integer giving the order of the neighborhood. nodes: The vertices for which the calculation is performed. mode: Character constant, it specifies how to use the direction of the edges if a directed graph is analyzed. For ‘out’ only the outgoing edges are followed, so all vertices reachable from the source vertex in at most order steps are counted. For ‘"in"’ all vertices from which the source vertex is reachable in at most order steps are counted. ‘"all"’ ignores the direction of the edges. This argument is ignored for undirected graphs. mindist: The minimum distance to include the vertex in the result.

require(igraph) g ego_size(g, order = 2, 1:3) [1] 7 11 17 > ego(g, order = 2, 1:3) [[1]] + 7/20 vertices, named, from 3e32cac: [1] A B D E C F J [[2]] + 11/20 vertices, named, from 3e32cac: [1] B A C E F D I L P J G [[3]] + 17/20 vertices, named, from 3e32cac: [1] C B D E I L P A F J H K M O T Q S > make_ego_graph(g, order = 2, 1:3) [[1]] IGRAPH b0112be UN-- 7 11 -- + attr: name (v/c) + edges from b0112be (vertex names): [1] A--B B--C A--D C--D A--E B--E C--E D--E B--F E--J F--J [[2]] IGRAPH 0f2cef6 UN-- 11 20 -- + attr: name (v/c) + edges from 0f2cef6 (vertex names): [1] A--B A--D A--E B--C B--E B--F C--D C--E C--I C--L C--P D--E E--J [14] F--G F--I F--J G--J I--J I--L I--P [[3]] IGRAPH 65a3787 UN-- 17 33 -- + attr: name (v/c) + edges from 65a3787 (vertex names): [1] A--B A--D A--E B--C B--E B--F C--D C--E C--I C--L C--P D--E E--J [14] F--I F--J H--I H--J I--J I--L I--P K--L K--O L--M L--O L--T M--O [27] M--S O--T P--Q P--S P--T Q--T S--T 2. igraph+egor

样本数据表格式:

alter 数据 ego 数据表 alter-alter数据 require(egor) #加载数据 data("alters32") ## alters in ego net data("egos32") ## ego list in ego net data("edges32") ## alter-later ties (edges) in ego net #生成egor object e1 15, ] subset(e1, .alts$alter.sex=="w", unit="alter") subset(e1, .aaties$weight > 1, unit="aatie") summary(e1) #计算density ego_density(e1) ##可视化 data("egor32") # Simplify networks to clustered graphs, stored as igraph objects graphs


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3