class: center, middle, inverse, title-slide .title[ # 社会网络分析 ] .subtitle[ ## 社会学研究方法——第10讲 ] .author[ ### 李代 ] .institute[ ### 中国政法大学社会学院 ] .date[ ### 2025-05-01 ] --- class: center, middle, inverse <!-- background-image: url("images/cool.png") --> # 社会网络分析 ## 网络的基本要素 ## 网络的性质 ## 研究网络的意义 --- # 网络的基本要素 ## 六度区隔 .pull-left[ > I read somewhere that everybody on this planet is separated by only six other people. Six degrees of separation. Between us and everybody else on this planet. ] .pull-right[ <img src="image/6degree.png" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的基本要素 ## 六度区隔 .pull-left[ Milgram, Stanley. 1967. the Small World Problem. Psychology Today 2:60-67 从美国中西部的Nebraska州和Kansas州随机抽取人,让他们把信寄给波士顿的某人。如果不认识这个人(两个人之间以名相称),可以把信寄给觉得更有可能认识目标的人,让其接力下去。 实验结果:160封信收回42封,平均需要5.5个中间人。 ] .pull-right[ <img src="image/6degree.gif" width="100%" style="display: block; margin: auto;" /> ] 你们和物理学诺贝尔奖获奖人中间隔着几个人? --- # 网络的基本要素 ## 社交网络 .pull-left[ <img src="image/sn.png" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="image/snmovie.jpg" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的基本要素 ## [Marvel漫画人物网络](https://www.kaggle.com/csanhueza/the-marvel-universe-social-network) <img src="image/marvel.png" width="80%" style="display: block; margin: auto;" /> [Naman Sehgal: MARVEL HERO SOCIAL NETWORK – GEPHI](https://studentwork.prattsi.org/infovis/labs/marvel-hero-social-network-gephi/) --- # 网络的基本要素 ## 性关系网络 Bearman et al. 2004 “别跟你前男友的现女友的前男友约会。” <img src="image/bearman2004.jpg" width="70%" style="display: block; margin: auto;" /> --- # 网络的基本要素 ## 基本要素 .pull-left[ 1. 节点(Node) + 度(degree) 1. 边(Edge) + 有向边 + 无向边 1. 小团体(Clique) ] .pull-right[ <img src="image/networkfeatures.png" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的基本要素 ## 基本要素 .pull-left[ 共同出现(co-occurrence) <img src="image/marvel.png" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ 互动(interaction) <img src="image/bearman2004.jpg" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的基本要素 ## 基本要素 .pull-left[ 1. 链(walk) + 点与边的一个序列,起点和终点都是节点,每个节点都和序列中前后的边相连 1. 迹(trail) + 链中所有边都不相同 1. 路(path) + 链中所有边和节点都不相同 ] .pull-right[ <img src="image/networkfeatures.png" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的基本要素 ## 基本要素 .pull-left[ 1. 圈(cycle) + 至少包括三个节点的无重复边的同一节点为起点和终点的链,除起点和终点外无重复点 1. 树(tree) + 一个联通且无圈的图被称作树 1. 森林(forest) + 一个不联通且无圈的图被称作森林 “林中漫步” ] .pull-right[ <img src="image/networkfeatures.png" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的基本要素 ## 图 <img src="image/R-C.jpg" width="100%" style="display: block; margin: auto;" /> --- # 网络的基本要素 ## 图 <img src="image/marvel.png" width="100%" style="display: block; margin: auto;" /> --- # 网络的基本要素 ## 图 .pull-left[ |source |target | weight| |:--------|:--------|------:| |蜘蛛侠 |钢铁侠 | 25| |蜘蛛侠 |玛丽简 | 21| |蜘蛛侠 |绿魔 | 24| |钢铁侠 |美国队长 | 26| |钢铁侠 |战争机器 | 20| |钢铁侠 |小辣椒 | 30| |美国队长 |冬兵 | 27| |美国队长 |猎鹰 | 22| |美国队长 |蜘蛛侠 | 28| ] .pull-right[ |name |race |sex | |:--------|:----|:---| |蜘蛛侠 |w |m | |玛丽简 |w |f | |绿魔 |w |m | |钢铁侠 |w |m | |战争机器 |b |m | |小辣椒 |w |f | |美国队长 |w |m | |猎鹰 |b |m | |冬兵 |w |m | ] --- # 网络的基本要素 ## 图 | | 蜘蛛侠| 钢铁侠| 美国队长| 玛丽简| 绿魔| 战争机器| 小辣椒| 冬兵| 猎鹰| |:--------|------:|------:|--------:|------:|----:|--------:|------:|----:|----:| |蜘蛛侠 | 0| 1| 1| 1| 1| 0| 0| 0| 0| |钢铁侠 | 1| 0| 1| 0| 0| 1| 1| 0| 0| |美国队长 | 1| 1| 0| 0| 0| 0| 0| 1| 1| |玛丽简 | 1| 0| 0| 0| 0| 0| 0| 0| 0| |绿魔 | 1| 0| 0| 0| 0| 0| 0| 0| 0| |战争机器 | 0| 1| 0| 0| 0| 0| 0| 0| 0| |小辣椒 | 0| 1| 0| 0| 0| 0| 0| 0| 0| |冬兵 | 0| 0| 1| 0| 0| 0| 0| 0| 0| |猎鹰 | 0| 0| 1| 0| 0| 0| 0| 0| 0| --- # 网络的基本要素 ## 图 “图” = graph “图” ≠ picture 软件: 1. [Gephi](https://gephi.org/) 1. [ORA](http://casos.cs.cmu.edu/projects/ora/) 1. [R](https://www.r-project.org/) + `igraph` 1. [Python](https://www.python.org/) + `NetworkX` [等等](https://www.rankred.com/free-social-network-analysis-tools/) --- class: center, middle, inverse <!-- background-image: url("images/cool.png") --> # 网络的性质 --- # 网络的性质 ## 科尼斯堡的桥 .pull-left[ 不重复经过任何一座桥的充分必要条件:有且仅有2个或0个奇数度数的节点。而且一定从奇数点开始走。 欧拉路、欧拉链(Eulerian path or Euler walk)。 图论的第一个定理,拓扑学(topology)的先声。 ] .pull-right[ <img src="image/bridge.jpg" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的性质 ## 度数 .pull-left[ 1. 对于无向网络,所有节点的度数之和除以节点数就是平均度数。 1. 对于有向网络,平均度数可以分输入和输出分别计算。 区分:节点的度数与图的度数(总度数、平均度数等等) ] .pull-right[ 英文的维基百科词条互相引用的度数分布 <img src="image/wiki.png" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的性质 ## 接近性(closeness) 到达图中其他节点的路径有多长? `\(g\)`: 图中节点的数量 `$$C_c(n_i) = \frac{1}{\sum_{j = 1}^{g}d(n_i,n_j)}$$` 标准化: `$$C_c^{'}(n_i) = \frac{g-1}{\sum_{j = 1}^{g}{d(n_i,n_j)}}$$` --- # 网络的性质 ## 接近性(closeness) <img src="method-network_files/figure-html/unnamed-chunk-20-1.png" style="display: block; margin: auto;" /> --- # 网络的性质 ## 中心性(betweenness) 有多少条最短路径经过这一节点? `$$C_b(n_i) = \sum_{j<k}{\frac{g_{jk}(n_i)}{g_jk}}$$` 标准化: `$$C_b^{'}(n_i) = \frac{C_b(n_i)}{\frac{(g-1)(g-2)}{2}}$$` `\(i\)` 表示其他两个不同节点 `\(j,k\)` 之间最短路径上的一个节点。$g_jk$ 表示$j, k$之间最短路径的数目。其中某一条路径被选中的概率就是 `\(\frac{1}{g_jk}\)`。 假如这些最短路径里面有 `\(g_jk(n_i)\)` 条路径,那么$i$被选中的概率就是 `\(g_jk(n_i)/g_jk\)`。 中心性=对除了 `\(i\)` 之外所有其他节点之间最短路径包含i的概率求和。 最大值为 `\(\frac{(g-1)(g-2)}{2}\)` --- # 网络的性质 ## 中心性(betweenness) <img src="method-network_files/figure-html/unnamed-chunk-21-1.png" style="display: block; margin: auto;" /> --- # 网络的性质 ## 正则网络 .pull-left[ 正则图(regular graph):各顶点的度均相同的无向简单图。 正则图没有随机性。 ] .pull-right[ <img src="image/regular.gif" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的性质 ## 随机网络 .pull-left[ `\(G(n, M)\)` : 从所有拥有n个顶点、M条边的图中随机抽取 `\(G(n, p)\)` : 建立n个顶点,每两个顶点之间有一条边的概率是p Gilbert, E.N. (1959). "Random Graphs". Annals of Mathematical Statistics. 30 (4): 1141–1144. Erdos, P. and Renyi, A., On random graphs, Publicationes Mathematicae 6, 290–297 (1959). ] .pull-right[ <img src="image/random.gif" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的性质 ## 随机网络 .pull-left[ 随机图中,顶点的度数分布符合泊松分布。 大多数顶点拥有的度数接近网络的平均度数,并且在均值两侧快速递减。 不符合真实世界的情况。 ] .pull-right[ n = 1000, p = 0.3, 平均度数:299.89 <img src="image/randomgraph.jpg" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的性质 ## 小世界 .pull-left[ Duncan Watts 等效仿Milgram实验。要求人们发送电子邮件给18个目标、涉及13个国家、60000多人参与,发现距离目标的度数中位数在5-7之间。 Dodds, Peter Sheridan, Roby Muhamad, and Duncan J. Watts. "An Experimental Study of Search in Global Social Networks." Science 301.5634 (2003): 827-829. ] .pull-right[ 现实世界是一团一团的人联系起来的,而非随机链接。 Watts, Duncan J., and Steven H. Strogatz. "Collective dynamics of 'small-world' networks." Nature 393.6684 (1998): 440-442. <img src="image/smallworld.gif" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的性质 ## 无尺度网络 .pull-left[ 正态分布 <img src="image/iq.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ 对数正态分布 <img src="image/lognormal.png" width="100%" style="display: block; margin: auto;" /> ] --- # 网络的性质 ## 无尺度网络 幂律分布:有些极小的数值频率极高,有些极大的数值频率极低。取对数后呈线性关系。 <img src="image/scalefree.png" width="100%" style="display: block; margin: auto;" /> --- # 网络的性质 ## 无尺度网络 无尺度网络:有些网络的节点度数分布符合幂律。 1. Preferential attachment. 1. Nodes do not die. Barabasi, Albertlaszlo, and Reka Albert. "Emergence of scaling in random networks." Science 286.5439 (1999): 509-512. <img src="image/powerlaw.png" width="60%" style="display: block; margin: auto;" /> --- class: center, middle, inverse <!-- background-image: url("images/cool.png") --> # 研究网络的意义 --- # 研究网络的意义 ## 邓巴常数 Dunbar, R. I. M. (1992). "Neocortex size as a constraint on group size in primates". Journal of Human Evolution. 22 (6): 469–493. 人的前额叶大小决定了人能维持的社会关系数量有限。 150 个稳定的关系:走进酒馆,一起喝酒不觉得尴尬。 --- # 研究网络的意义 ## 找工作:弱关系的强项 Mark S. Granovetter. 1973. "The Strength of Weak Ties," American Journal of Sociology 78: 1360-1380 找工作:更大概率是通过跟弱关系的联络找到的。(异质性的信息) 反对:找工作也得靠强关系。 Felicia F.Tian & Nan Lin, 2016, [Weak ties, strong ties, and job mobility in urban China: 1978–2008](Weak ties, strong ties, and job mobility in urban China: 1978–2008), social networks. --- # 研究网络的意义 ## 物以类聚 Miller McPherson, Lynn Smith-Lovin, and James M Cook, BIRDS OF A FEATHER: Homophily in Social Networks, Annu. Rev. Sociol. 2001. 27:415–44 > Similarity breeds connection. This principle—the homophily principle—structures network ties of every type, including marriage, friendship, work, advice, support, information transfer, exchange, comembership, and other types of relationship. The result is that people’s personal networks are homogeneous with regard to many sociodemographic, behavioral, and intrapersonal characteristics. Homophily limits people’s social worlds in a way that has powerful implications for the information they receive, the attitudes they form, and the interactions they experience. Homophily in race and ethnicity creates the strongest divides in our personal environments, with age, religion, education, occupation, and gender following in roughly that order. Geographic propinquity, families, organizations, and isomorphic positions in social systems all create contexts in which homophilous relations form. Ties between nonsimilar individuals also dissolve at a higher rate, which sets the stage for the formation of niches (localized positions) within social space. --- # 研究网络的意义 ## 3度传播 Christakis, Nicholas A., and James H. Fowler. "Social contagion theory: examining dynamic social networks and human behavior." Statistics in Medicine 32.4 (2013): 556-577. <img src="image/3degree.png" width="60%" style="display: block; margin: auto;" /> --- # 研究网络的意义 ## 学术圈子 .pull-left[ Moody, James. “The Structure of a Social Science Collaboration Network: Disciplinary Cohesion from 1963 to 1999.” American Sociological Review, vol. 69, no. 2, 2004, pp. 213–238. JSTOR, JSTOR, www.jstor.org/stable/3593085. ] .pull-right[ <img src="image/idea.png" width="100%" style="display: block; margin: auto;" /> ] --- # 研究网络的意义 ## 反思 “圈”“层” 房地产中介:“我愿意卖别墅,接触到的客户,他的圈层比较高端。”