FIG python tool based on a random dynamic network model block in FIG detecting a network society

Original link: http://tecdat.cn/?p=7589

 

This is the "political blog rings and the 2004 US presidential election," political blog network map, but the edge of the beam is to use random block model identified (Note: The following illustration is the same diagram (ie, the same layout and data)). Tiago paper 5 I just put on top of a black background.

The same as the original paper edge color scheme with Adamic and Glance in that each node corresponds to a blog URL, color reflect the political orientation, red for conservative, blue represents liberals. Orange side from liberal to conservative blog blog, purple edge from conservatives to liberals (see Adamic and Glance in Figure 1).

Original:

 

 

Part of the code fragment:

# -*- coding: utf-8 -*-
import graph_tool.all as gt
import math

g = gt.collection.data["polblogs"] # http://www2.scedu.unibo.it/roversi/SocioNet/AdamicGlanceBlogWWW.pdf print(g.num_vertices(), g.num_edges()) #reduce to only connected nodes g = gt.GraphView(g,vfilt=lambda v: (v.out_degree() > 0) and (v.in_degree() > 0) ) g.purge_vertices() print(g.num_vertices(), g.num_edges()) #use 1->Republican, 2->Democrat red_blue_map = {1:(1,0,0,1),0:(0,0,1,1)} plot_color = g.new_vertex_property('vector<double>') g.vertex_properties['plot_color'] = plot_color for v in g.vertices(): plot_color[v] = red_blue_map[g.vertex_properties['value'][v]] gt.graph_draw(g, pos=pos, vertex_fill_color=g.vertex_properties['plot_color'], vertex_color=g.vertex_properties['plot_color'], edge_control_points=cts, vertex_size=10, vertex_text=g.vertex_properties['label'], vertex_text_rotation=g.vertex_properties['text_rot'], vertex_text_position=1, vertex_font_size=9, edge_color=g.edge_properties['edge_color'], vertex_anchor=0, bg_color=[0,0,0,1], output_size=[4024,4024], output='polblogs_blockmodel.png')

 If you have any questions, please leave a comment below. 

 

 

  

Big Data tribe  - Chinese professional third-party data service providers to provide customized one-stop data mining and statistical analysis consultancy services

Statistical analysis and data mining consulting services: y0.cn/teradat (Consulting Services, please contact the official website customer service )

Click here to send me a messageQQ:3025393450

 

QQ exchange group: 186 388 004 

[Service] Scene  

Research; the company outsourcing; online and offline one training; data reptile collection; academic research; report writing; market research.

[Tribe] big data to provide customized one-stop data mining and statistical analysis consultancy

Welcome to elective our R language data analysis will be mining will know the course!

 

  

Big Data tribe  - Chinese professional third-party data service providers to provide customized one-stop data mining and statistical analysis consultancy services

Statistical analysis and data mining consulting services: y0.cn/teradat (Consulting Services, please contact the official website customer service )

Click here to send me a messageQQ:3025393450

 

QQ exchange group: 186 388 004 

[Service] Scene  

Research; the company outsourcing; online and offline one training; data reptile collection; academic research; report writing; market research.

[Tribe] big data to provide customized one-stop data mining and statistical analysis consultancy

Welcome to elective our R language data analysis will be mining will know the course!

 

Guess you like

Origin www.cnblogs.com/tecdat/p/11655060.html