tethne.networks.helpers module¶
Helper functions for generating networks.
citation_count | Generates citation counts for all of the papers cited by papers. |
simplify_multigraph | Simplifies a graph by condensing multiple edges between the same node pair into a single edge, with a weight attribute equal to the number of edges. |
top_cited | Generates a list of the topn (or topn%) most cited papers. |
top_parents | Returns a list of Paper that cite the topn most cited papers. |
- tethne.networks.helpers.citation_count(papers, key='ayjid', verbose=False)[source]¶
Generates citation counts for all of the papers cited by papers.
Parameters: papers : list
A list of Paper instances.
key : str
Property to use as node key. Default is ‘ayjid’ (recommended).
verbose : bool
If True, prints status messages.
Returns: counts : dict
Citation counts for all papers cited by papers.
- tethne.networks.helpers.simplify_multigraph(multigraph, time=False)[source]¶
Simplifies a graph by condensing multiple edges between the same node pair into a single edge, with a weight attribute equal to the number of edges.
Parameters: graph : networkx.MultiGraph
E.g. a coauthorship graph.
time : bool
If True, will generate ‘start’ and ‘end’ attributes for each edge, corresponding to the earliest and latest ‘date’ values for that edge.
Returns: graph : networkx.Graph
A NetworkX graph .
- tethne.networks.helpers.top_cited(papers, topn=20, verbose=False)[source]¶
Generates a list of the topn (or topn%) most cited papers.
Parameters: papers : list
A list of Paper instances.
topn : int or float {0.-1.}
Number (int) or percentage (float) of top-cited papers to return.
verbose : bool
If True, prints status messages.
Returns: top : list
A list of ‘ayjid’ keys for the topn most cited papers.
counts : dict
Citation counts for all papers cited by papers.
- tethne.networks.helpers.top_parents(papers, topn=20, verbose=False)[source]¶
Returns a list of Paper that cite the topn most cited papers.
Parameters: papers : list
A list of Paper objects.
topn : int or float {0.-1.}
Number (int) or percentage (float) of top-cited papers.
verbose : bool
If True, prints status messages.
Returns: papers : list
A list of Paper objects.
top : list
A list of ‘ayjid’ keys for the topn most cited papers.
counts : dict
Citation counts for all papers cited by papers.