Download presentation
Presentation is loading. Please wait.
1
Central Nodes (Python and Gephi)
2
Python code Use Metrics.py from the workshop’s website
3
NetworkX Reference Github interactive version
PDF reference for NetworkX Github interactive version
4
Finding centralities The part of the code that finds and prints centralities: Output not sorted, rather a list as: Node: centrality_value
5
Follow along or try it Follow along:
Or try the code on your computer, the same zip file from the main page, and use MetricsV2-ForPython3.py (for version 3.5) or MetricsV2-ForPython2.py (for version 2.7)
6
Top centrality nodes Cod: MetricsV2-ForPython2 (or 3)
This part of the code arranges and prints the top 10 central nodes (degree centrality) Python 2.7: Python 3.5: The ten was arbitrary, change it here:
7
Closeness/Eigenvector
The closeness centrality is normalized by dividing by (n-1), where n is the number of nodes in the connected part of graph containing the node. If the graph is not completely connected, this algorithm computes the closeness centrality for each connected part separately. The eigenvector calculation is done by the power iteration method and has no guarantee of convergence. The iteration will stop after max_iter iterations or an error tolerance of number_of_nodes(G)*tol has been reached. For directed graphs this is “left” eigevector centrality which corresponds to the in-edges in the graph. For out-edges eigenvector centrality first reverse the graph with G.reverse().
8
Visualizing them on the network
Code that identifies the top 30%: I have not implemented it, you can try it if you would like.
9
Gephi Excellence Through Knowledge
10
Resources for Gephi: Overview and explanations of Gephi
Gephi’s overview tutorial An introductory video to create data for Gephi and to use degree, closeness and betweeness (also posted on the website unde today’s lecture). Gephi’s overview of layouts Basic navigation
11
Layouts Choose the appropriate layout so that visualization is meaningful. Common force directed (repulsion) ones: Force Atalas 2 (It is focused on being useful to explore and get meaning for real data, and a good readability, slow) Yifan Hu (similar to FA2, fast, good for large graphs) Fruchterman-Reingold (The nodes are the mass particles and the edges are springs between the particles. The algorithms try to minimize the energy of this physical system. It has become a standard but remains very slow.) OpenOrd layout (good for communities) Not force directed: Expansion Geographic map with GeoLayout
12
SAVE Once you have a visualization that you like, save the network, so that the next time you open it looks the same Cannot use undo in Gephi When you run an analysis, save the network again with a different name for future references When you open part of a network on a new tab in Gephi, save that as well.
13
Preview Tab Click Preview next to the Data Laboratory, you might like that view of the network better: If you export, then this is what you export:
14
Centrality graph example
Open both your network and this graph (you can also find it on the website). Source: Discovering Sets of Key Players in Social Networks – Daniel Ortiz-Arroyo – Springer 2010/
15
Centralities Click diameter under Statistics module on the right
Centralities that are available: Closeness PageRank HITS Betweeness For directed graphs, check:
16
Ranking nodes by centrality
Once you ran a metric, you can size/color the nodes based on your choices you ran. Under on the top left, choose Nodes and either size or color Depending on the version you run, you will see:
17
Filtering nodes by centralty
Find Filters on the top right, next to Statistics Under topology, you can find the centralities Choose one, drag and drop it to the Queries Choose the bounds needed.
18
Export You can export the visualized graph as SVG or PDF:
Go to preview (fix if needed) Resize for large networks Click SVG (SVG is vectorial graphics like PDF so they scale to different sizes nicely)
19
Other metrics Average path length: under the statics module, right
Computes the average of shortest paths between all pairs of nodes Result:
20
Most of these are not in Gephi/Python/R
An interactive periodic table of centralities:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.