textnets.network.ProjectedTextnet¶
- class textnets.network.ProjectedTextnet(graph: Graph)[source]¶
Bases:
TextnetBase
One-mode projection of a textnet.
Created by calling
Textnet.project()
with the desirednode_type
.- graph¶
Direct access to the igraph object.
- Type:
Methods
Return graph backbone.
Return the number of edges.
Plot the projected graph.
Save the underlying graph.
Show nodes sorted by betweenness.
Show nodes sorted by closeness.
Show top nodes per cluster, ranked by a chosen metric.
Show nodes sorted by unweighted degree.
Show nodes sorted by eigenvector centrality.
Show nodes sorted by eigenvector centrality.
Show nodes sorted by harmonic centrality.
Show nodes sorted by PageRank centrality.
Show nodes sorted by textual spanning.
Show nodes sorted by weighted degree.
Return the number of vertices (nodes).
Attributes
Weighted betweenness centrality.
Weighted closeness centrality.
Weighted local clustering coefficient within each cluster's subgraph.
Weighted node degree within each cluster's subgraph.
Return graph partition.
Unweighted node degree.
Iterate of edges.
Weighted eigenvector centrality.
Weighted harmonic centrality.
Weighted adjacency matrix.
Return modularity based on graph partition.
Return list of node types.
Iterate over nodes.
Weighted PageRank centrality.
Textual spanning measure.
Weighted node degree.
Summary of underlying graph.
- alpha_cut(alpha: float) ProjectedTextnet [source]¶
Return graph backbone.
- Parameters:
alpha (float) – Threshold for edge elimination. Must be between 0 and 1. Edges with an alpha value above the specified threshold are removed.
- Returns:
New textnet sans pruned edges.
- Return type:
- property cluster_local_cc: Series¶
Weighted local clustering coefficient within each cluster’s subgraph.
- property clusters: VertexClustering¶
Return graph partition.
The partition is detected by the Leiden algorithm, unless a different partition that was supplied to the setter.
- property edges: EdgeSeq¶
Iterate of edges.
- property nodes: VertexSeq¶
Iterate over nodes.
- plot(*, alpha: float | None = None, **kwargs) CairoPlot [source]¶
Plot the projected graph.
- Parameters:
alpha (float, optional) – Threshold for edge elimination. Must be between 0 and 1. Edges with an alpha value above the specified threshold are removed. This is useful when plotting “hairball” graphs.
scale_nodes_by (str, optional) – Name of centrality measure or node attribute to scale nodes by. Possible values:
degree
,strength
,betweenness
,closeness
,eigenvector_centrality
,pagerank
or any node attribute (default: None).target (str or file, optional) – File or path that the plot should be saved to (e.g.,
plot.png
).kwargs – Additional arguments to pass to
igraph.drawing.plot
.
- Returns:
The plot can be directly displayed in a Jupyter notebook or saved as an image file.
- Return type:
- save_graph(target: str | bytes | PathLike[Any] | IO, format: str | None = None) None ¶
Save the underlying graph.
- Parameters:
target (str or path or file) – File or path that the graph should be written to.
format ({"dot", "edgelist", "gml", "graphml", "pajek", ...}, optional) – Optionally specify the desired format (otherwise it is inferred from the file suffix).
- top_betweenness(n=10)¶
Show nodes sorted by betweenness.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type:
- top_closeness(n=10)¶
Show nodes sorted by closeness.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type:
- top_cluster_nodes(n: int = 10, rank_nodes_by: str = 'cluster_strength') DataFrame ¶
Show top nodes per cluster, ranked by a chosen metric.
- Parameters:
- Returns:
Clusters with representative nodes.
- Return type:
- top_degree(n=10)¶
Show nodes sorted by unweighted degree.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type:
- top_eigenvector_centrality(n=10)¶
Show nodes sorted by eigenvector centrality.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type:
- top_ev(n=10)¶
Show nodes sorted by eigenvector centrality.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type:
- top_harmonic(n=10)¶
Show nodes sorted by harmonic centrality.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type:
- top_pagerank(n=10)¶
Show nodes sorted by PageRank centrality.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type:
- top_spanning(n=10)¶
Show nodes sorted by textual spanning.
- Parameters:
n (int, optional) – How many nodes to show (default: 10).
- Returns:
Ranked nodes.
- Return type: