Need help? Have a feature request? Please check out the tethne-users group .


Everything starts with bibliographic metadata. Tethne supports the ISI Web of Science field-tagged format, JSTOR Data-for-Research XML format, and Zotero RDF. For details on how to obtain metadata in the correct format, see Getting Bibliographic Metadata.

You can find parsers in the tethne.readers module.

Let’s parse a WoS field-tagged metadata file.

>>> from tethne.readers import wos
>>> corpus ='/path/to/my/data.txt')

Now I have a Corpus instance with 500 Paper instances:

>>> len(corpus)

A Corpus is basically just an indexed container for bibliographic records. Each bibliographic record is represented by a Paper instance.

For more information about parsing bibliographic metadata, see Parsing Bibliographic Metadata.

Network-building methods are available in tethne.networks. You can create a coauthors() network like this:

>>> from tethne.networks import coauthors
>>> coauthor_graph = coauthors(corpus)

All of Tethne’s graph-building methods return networkx.Graph objects. For more information, see the NetworkX documentation. The upshot is that you can use any of the algorithms in NetworkX to analyze your graphs!

If you’re using WoS data (with citations), you can also build citation-based graphs (see networks.papers). Here’s a static co-citation graph from a Corpus:

>>> from tethne.networks import cocitation
>>> cocitation_graph = cocitation(corpus, min_weight=3)

min_weight=3 means that a pair of papers must be co-cited three times to be included in the network.

To create a time-variant coauthor network, use a GraphCollection.

>>> from tethne import GraphCollection
>>> coauthor_collection = GraphCollection(corpus, coauthors)
>>> coauthor_collection.node_distribution()
{1980: 32,
 1981: 26,
 1982: 24,
 1983: 26,
 1984: 20,
 1985: 30,
 1986: 35,
 1987: 49,
 1988: 60,
 1989: 66,
 1990: 69,
 1991: 85,
 1992: 82,
 1993: 91,
 1994: 110}

For more information about building graphs from bibliographic metadata, see Building Graphs.

You can export a graph for visualization in Cytoscape or Gephi using tethne.writers:

>>> from tethne.writers.graph import to_graphml
>>> to_graphml(coauthor_graph, '/path/to/my/graph.graphml')

For more information about exporting graphs, see Serializing Graphs.