Analyzing Bibliographic Networks

All networks in Tethne are NetworkX Graphs. This means means that you can use the rich suite of algorithms provided by NetworkX to analyze your bibliographic networks.

Analyzing individual networks

If you built your network directly from a list of Paper, you can import and use NetworkX directly.

To calculate the betweenness-centrality of all of the nodes in a bibliographic coupling network, for example, use:

>>> # Parse your data:
>>> import tethne.readers as rd
>>> wos_list = rd.wos.parse_wos("/Path/to/savedrecs.txt")
>>> papers = rd.wos.rad(wos_list)

>>> # Build a bibliographic coupling network:
>>> import tethne.networks as nt
>>> BC = nt.papers.bibliographic_coupling(papers)

>>> # Use the NetworkX betweenness-centrality algorithm:
>>> import networkx as nx
>>> btw = nx.betweenness_centrality(G)
>>> btw
{'a': 0.0, 'c': 0.0, 'b': 0.6666666666666666, 'd': 0.0}

To add the betweenness-centrality values to your network as node attributes...

>>> nx.set_node_attributes(BC, 'betweenness', btw)

You can find a complete list of graph analysis algorithms in the NetworkX documentation.

A few additional methods internal to Tethne can be found in the analyze.graph module.

Analyzing a GraphCollection

The analyze.collection sub-package provides mechanisms for analyzing an entire GraphCollection. Most NetworkX algorithms are accessible via analyze.collection.algorithm(). To calculate betweenness centrality for an entire GraphCollection, for example, use:

>>> import tethne.analyze as az
>>> BC = az.collection.algorithm(C, 'betweenness_centrality')
>>> print BC[0]
{1999: 0.010101651117889644,
2000: 0.0008689093723107329,
2001: 0.010504898852426189,
2002: 0.009338654511194512,
2003: 0.007519105636349891}

For more information, see the analyze.collection sub-package.

Methods

tethne.analyze.collection.algorithm(C, ...) Apply NetworkX method to each Graph in GraphCollection.
tethne.analyze.collection.connected(C, ...) Performs analysis methods from networkx.connected on each graph in the collection.
tethne.analyze.collection.edge_history(C, ...) Returns a dictionary of attribute vales for each Graph in C for a single
tethne.analyze.collection.node_history(C, ...) Returns a dictionary of attribute values for each Graph in C for a single
tethne.analyze.collection.node_global_closeness_centrality(C, node) Calculates global closeness centrality for node in each graph in

Table Of Contents

Previous topic

Creating Networks from Bibliographic Data

Next topic

Command-line Options

This Page