看啥推荐读物
专栏名称: 小伍哥聊风控
风控策略&算法,内容风控、复杂网络挖掘、图神经网络、异常检测、策略自动化、黑产挖掘、反欺诈、反作弊等
目录
相关文章推荐
今天看啥  ›  专栏  ›  小伍哥聊风控

令人惊艳的社会网络可视化库igraph!

小伍哥聊风控  · 公众号  ·  · 2023-12-26 07:01
最近在研究igraph这个库,发现这个库对关系网络的可视化挺惊艳的,分享下,风控业务中经常会遇到,首先安装下,注意不要 pip install igraph,这个安装不了,需要按下面的方法安装。pip install python-igraph本次数据集的下载网站:https://public.websites.umich.edu/~mejn/netdata/不想下载的,我下载了一份,后台回复【网络可视化】获取。#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Created on Mon Dec 25 21:53:09 2023@author: wuzhengxiang"""import igraph as igimport matplotlib.pyplot as pltimport os#设置工作空间path = '/Users/wuzhengxiang/Documents/算法文档/igraph'os.chdir(path)# 数据读取g = ig.load("lesmis.gml")print(g)# 社区划分communities = g.community_edge_betweenness()communities = communities.as_clustering()# 查看社区划分结果for i, community in enumerate(communities): print(f"Community {i}:") for v in community: print(f"\t{g.vs[v]['label']}")# 社区 ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照