GitMA Network#

Note

This class is integrated in the CatmaProject and AnnotationCollection class. See the examples in the introduction.

class Network(annotation_collections, character_distance=100, edge_func='cooccurrent', included_tags=None, excluded_tags=None, level='tag', network_layout=<function kamada_kawai_layout>)#

Bases: object

Class to draw annotation coocurrence network graphs.

Parameters
  • annotation_collections (List[AnnotationCollection]) – List of included annotation collections.

  • character_distance (int, optional) – Cooccurrence span. Defaults to 100.

  • edge_func (str, optional) – Keyword for the function that identifies connected annotations. Either 'cooccurent' or 'overlapping'. Defaults to cooccurrent_annotations.

  • included_tags (list, optional) – Included tags. If None and excluded_tags None all tags are included. Defaults to None.

  • excluded_tags (list, optional) – Excluded tags. Defaults to None.

  • level (str, optional) – Whether the annotations tag or the values of the given property gets included.

  • network_layout (callable, optional) – NetworkX Drawing Layout. Defaults to nx.drawing.layout.kamada_kawai_layout.

edge_func: callable#

The edge function.

level: str#

The annotation level.

df: pandas.core.frame.DataFrame#

Merged annotations dataframe

edges: List[gitma._network.Edge]#

List of edge objects.

network_graph: networkx.classes.graph.Graph#

The networkX graph object.

pos: dict#

The node position

to_gexf(filename='catma_network', directory='./')#

Writes Network Graph to a GEPHI xml file.

Parameters
  • filename (str, optional) – The name of the gexf file. Defaults to ‘catma_network’.

  • directory (str, optional) – The file’s directory. Defaults to ‘./’.

stats()#

Creates network stats data frame.

Returns

degree, weighted_degree, betweenness centrality, weighted betweenness centrality

Return type

pd.DataFrame

plot(node_size='weighted_degree', node_factor=100.0, node_alpha=15, plot_stats=False)#

Plots network as plotly graph.

Parameters
  • node_size (str, optional) – Which network metric to use as node size. Defaults to ‘betweenness’.

  • node_factor (float, optional) – Customize the node size. Defaults to 100.0.

  • node_alpha (int, optional) – Minimal node size. Defaults to 3.

  • plot_stats (bool, optional) – Whether to plot the stats as pandas.DataFrame. Defaults to True.