Bibliographic network

class pysyrev.BibNetwork(bib_dataset=None)[source]

Bases: object

Network analysis built from a BibDataset.

Two graph types are available:

Bibliographic coupling — documents as nodes, linked when they share

common references. See build_coupling_network().

Co-citation — references as nodes, linked when they appear together

in the reference list of at least one document. Resolved references that exist in the corpus are marked node_type=’internal’; unresolved external references are node_type=’external’. See build_cocitation_network().

Both graphs can coexist on the same BibNetwork instance.

Usage

net = BibNetwork(bib_dataset) net.build_coupling_network() net.build_cocitation_network() G_coupling = net.coupling_graph G_cocit = net.cocitation_graph

build_coupling_network(use_resolved=True, use_unresolved=True, min_shared=1)[source]

Build (or rebuild) the bibliographic coupling graph.

Parameters:
  • use_resolved (bool) – Use resolved internal reference IDs (requires resolve_references() to have been called on the source dataset).

  • use_unresolved (bool) – Use raw unresolved reference strings.

  • min_shared (int) – Minimum shared references to add an edge between two documents.

Return type:

BibNetwork

property coupling_graph
build_cocitation_network(use_resolved=True, use_unresolved=True, min_cocitations=1)[source]

Build (or rebuild) the co-citation graph.

Parameters:
  • use_resolved (bool) – Include resolved internal reference IDs as co-citation nodes.

  • use_unresolved (bool) – Include unresolved raw reference strings as co-citation nodes.

  • min_cocitations (int) – Minimum co-citation count to add an edge between two references.

Return type:

BibNetwork

property cocitation_graph
classmethod from_config(config)[source]
Return type:

BibNetwork

Parameters:

config (BibNetworkConfig)

run(dataset=None)[source]

Build coupling and co-citation graphs.

Parameters:

dataset (pd.DataFrame, optional) – Reviewed-included dataset. If None, loaded from doc_dataset (set via config or auto-detected by Config.load).

Return type:

BibNetwork

save(export_config=None)[source]

Export coupling and co-citation graphs to GraphML files.

GraphML is compatible with Gephi, Cytoscape, and networkx. shared_refs edge sets are serialised as semicolon-separated strings. Falls back to the export config provided at construction time (from YAML).

Return type:

BibNetwork

Parameters:

export_config (BibNetworkExportConfig)

property n_coupling_nodes: int
property n_coupling_edges: int
property n_cocitation_nodes: int
property n_cocitation_edges: int