From 68ac9be5e056ac604fcae0f289943c895dd7217a Mon Sep 17 00:00:00 2001 From: J Hancock <123655328+J-A-Ha@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:14:10 +0100 Subject: [PATCH] adding docstrings --- .../__pycache__/networks.cpython-39.pyc | Bin 56298 -> 56314 bytes art/classes/__pycache__/review.cpython-39.pyc | Bin 127940 -> 127940 bytes art/classes/networks.py | 146 +++++++----------- art/networks/network_functions.py | 10 +- 4 files changed, 63 insertions(+), 93 deletions(-) diff --git a/art/classes/__pycache__/networks.cpython-39.pyc b/art/classes/__pycache__/networks.cpython-39.pyc index 4494681ab19b864c62807f12919c9c69779bf15c..ecb936dd31ee74148e8bf1317e1c62942409a602 100644 GIT binary patch delta 4779 zcmb7I3s6+&72f~ugEy!^L~(g2imOI2YIupFsR(FR1k{L8K<9gVzufdPR}`a@9v_+j4*zj|J?KV z&iNnrzg}fmSfly8ZguCRQ9JC(9F> zbj3sD+44kr5@?3XbL7eL(;!95&&nxsDoDd*tDGjMgJhQH%2VV_kYeO~IZK`nQmidb z4tR^nGvsHQ48`&CJlk;j7cibFXEzy(N5}>4@hmw9#tG|n2A!#RWTDPds2KE9Crjl_ zguNV<{W{a>>UGV!UAhLg_6d;KE?u)Evt6uN4?1a~&OVIk@VC~`Y($OB>ZKPO>YGj;2l&mb6fzPa7qcz~7X#Q7l+2O&gzIuWt^immp|Jy^+vBXd?96 z#TxwUnJiUFn;EaG(8>B1)(~L#2g!g^z5ffL^#QU`HvL+H3jEfVig~3GVrY6nf<@1_ zL%;cKgcSg-CcX`2NmFpUSeyP!aVI?`z~$$3@Y<4PYeZ7UD8J{yLTB<9H5nGMDI*a6 z4VMBX(U#H64vC#pR))L-&n*FbBu45G=FH`6zi7(5nQ{mf?<4#bElhkJ$}tGB2!BK9 z1aRpq?X?zz7GeL?(X2~cnz}ChBed{@u`s?{CkC8~7}SFLV*n7;omNbn$}WpfrX8E) zu~*X?)wJG>SiQ@*yxLLblXKshVd84mKz3ERlQlz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b(5c-2FTSn|Dx(^TIfk#v^HITn+5Z6Y?XpJz diff --git a/art/classes/__pycache__/review.cpython-39.pyc b/art/classes/__pycache__/review.cpython-39.pyc index a0a025deb30ff58451a63d17f4d333d8fa17237d..30383e4f898ebc5015c9acdd7f6bc2d0649aec12 100644 GIT binary patch delta 24 ecmX@|oc+jicCJKTUM>b8D7R_k+RDYa>oWjjsRy3` delta 24 ecmX@|oc+jicCJKTUM>b8xM$VKwUvu;*Jl7{I0ys) diff --git a/art/classes/networks.py b/art/classes/networks.py index b809b74..7d13cdf 100644 --- a/art/classes/networks.py +++ b/art/classes/networks.py @@ -170,7 +170,7 @@ def is_weighted(self) -> bool: def degrees(self): """ - Returns the network's degree distributions as a dataframe. + Returns the network's degree distributions as a Pandas DataFrame. """ isdir = self.is_directed() @@ -230,7 +230,7 @@ def degrees_stats(self): def betweenness_dataframe(self): """ - Returns the network's betweenness centrality distribution as a dataframe. + Returns the network's betweenness centrality distribution as a Pandas DataFrame. """ df = pd.DataFrame(columns = ['vertex', 'betweenness']) @@ -266,7 +266,7 @@ def betweenness_stats(self): def eigencentralities_dataframe(self): """ - Returns the network's eigenvector centrality distribution as a dataframe. + Returns the network's eigenvector centrality distribution as a Pandas DataFrame. """ if self.is_directed() == True: @@ -308,7 +308,7 @@ def eigencentralities_stats(self): def authority_scores_dataframe(self): """ - Returns the network's authority scores distribution as a dataframe. + Returns the network's authority scores distribution as a Pandas DataFrame. """ df = pd.DataFrame(columns = ['vertex', 'authority_score']) @@ -345,7 +345,7 @@ def authority_scores_stats(self): def hub_scores_dataframe(self): """ - Returns the network's hub scores distribution as a dataframe. + Returns the network's hub scores distribution as a Pandas DataFrame. """ df = pd.DataFrame(columns = ['vertex', 'hub_score']) @@ -382,7 +382,7 @@ def hub_scores_stats(self): def coreness_dataframe(self): """ - Returns the network's coreness scores distribution as a dataframe. + Returns the network's coreness scores distribution as a Pandas DataFrame. """ df = pd.DataFrame(columns = ['vertex', 'coreness']) @@ -679,21 +679,27 @@ def all_centralities(self): sort_by = ['weighted_total_degree', 'total_degree', 'betweenness'] else: sort_by = ['weighted_degree', 'degree', 'betweenness', 'eigencentrality', 'authority_score','hub_score'] - + + if combined.index.dtype == 'float64': + combined.index = combined.index.astype(int) + return combined.sort_values(sort_by, ascending=False) def get_neighbours(self, vertex_name = 'request_input'): - """Returns vertex neighbours as a dataframe.""" + """Returns vertex neighbours as a Pandas Dataframe.""" if vertex_name == 'request_input': - vertex_name = input('Vertex name: ') + vertex_name = input('Vertex name or index: ') # Get vertex - vertex = self.vs.find(name = vertex_name) + if 'name' in self.vs.attributes(): + vertex = self.vs.find(name = vertex_name) + else: + vertex = self.vs[vertex_name] - # Get vertex neighbours in a dataframe + # Get vertex neighbours in a Pandas DataFrame df = pd.DataFrame(columns = ['vertex_id', 'vertex_name']) @@ -718,8 +724,14 @@ def get_degree(self, vertex_name = 'request_input', direction = 'all'): if vertex_name == 'request_input': vertex_name = input('Vertex name: ') + + # Get vertex + if 'name' in self.vs.attributes(): + vertex = self.vs.find(name = vertex_name) + else: + vertex = self.vs[vertex_name] - degree = len(self.vs.find(name = vertex_name).neighbors()) + degree = len(vertex.neighbors()) degree = int(degree) return degree @@ -757,7 +769,7 @@ def get_betweenness(self, vertex_name = 'request_input', direction = 'all'): def colinks(self, direction = 'out'): """ - Runs a colink analysis on the network. Returns a dataframe. + Runs a colink analysis on the network. Returns a Pandas DataFrame. Parameters ---------- @@ -823,6 +835,8 @@ def visualise(self, vertex_names = True, edge_weights = False, weight_by = 'weig def to_igraph(self) -> Graph: + """Returns the Network as an igraph Graph object.""" + is_dir = self.is_directed() g_attrs = self.attributes() @@ -1136,7 +1150,7 @@ def reciprocity(self, network = 'request_input', ignore_loops=True, mode='defaul def degrees_df(self, network = 'request_input', direction = 'all'): """ - Calculates the degree distribution of the network. Returns a dataframe. + Calculates the degree distribution of the network. Returns a Pandas DataFrame. Parameters ---------- @@ -1148,7 +1162,7 @@ def degrees_df(self, network = 'request_input', direction = 'all'): Returns ------- result : pandas.DataFrame - a dataframe containing the degree distribution of the graph. + a Pandas DataFrame containing the degree distribution of the graph. """ if network == 'request_input': @@ -1184,7 +1198,7 @@ def degrees_stats(self, network = 'request_input', direction = 'all'): Returns ------- result : pandas.DataFrame - a dataframe of frequency statistics for the degree distribution of the + a Pandas DataFrame of frequency statistics for the degree distribution of the graph. """ @@ -1201,7 +1215,7 @@ def degrees_stats(self, network = 'request_input', direction = 'all'): def betweenness_df(self, network = 'request_input', vertices=None, directed=True, cutoff=None, weights=None, sources=None, targets=None): """ - Calculates or estimates the betweenness of vertices in a network. Returns a dataframe. + Calculates or estimates the betweenness of vertices in a network. Returns a Pandas DataFrame. Also supports calculating betweenness with shortest path length cutoffs or considering shortest paths only from certain source vertices or to certain @@ -1234,7 +1248,7 @@ def betweenness_df(self, network = 'request_input', vertices=None, directed=True Returns ------- result : pandas.DataFrame - the (possibly cutoff-limited) betweenness of the given vertices in a dataframe. + the (possibly cutoff-limited) betweenness of the given vertices in a Pandas DataFrame. """ if network == 'request_input': @@ -1259,7 +1273,7 @@ def betweenness_df(self, network = 'request_input', vertices=None, directed=True def betweenness_stats(self, network = 'request_input', vertices=None, directed=True, cutoff=None, weights=None, sources=None, targets=None): """ - Returns frequency statistics for the betweenness of vertices in a network. Returns a dataframe. + Returns frequency statistics for the betweenness of vertices in a network. Returns a Pandas DataFrame. Parameters ---------- @@ -1288,7 +1302,7 @@ def betweenness_stats(self, network = 'request_input', vertices=None, directed=T Returns ------- result : pandas.DataFrame - frequency statistics for betweenness of the given vertices in a dataframe. + frequency statistics for betweenness of the given vertices in a Pandas DataFrame. """ if network == 'request_input': @@ -1305,7 +1319,7 @@ def betweenness_stats(self, network = 'request_input', vertices=None, directed=T def eigencentralities_df(self, network = 'request_input', scale=True, weights=None, return_eigenvalue=False): """ - Calculates the eigenvector centralities of the vertices in a graph. Returns a dataframe. + Calculates the eigenvector centralities of the vertices in a graph. Returns a Pandas DataFrame. Eigenvector centrality is a measure of the importance of a node in a network. It assigns relative scores to all nodes in the network based @@ -1349,7 +1363,7 @@ def eigencentralities_df(self, network = 'request_input', scale=True, weights=No Returns ------- result : pandas.DataFrame - the eigenvector centralities in a dataframe. + the eigenvector centralities in a Pandas DataFrame. """ if network == 'request_input': @@ -1423,7 +1437,7 @@ def eigencentralities_stats(self, network = 'request_input'): Returns ------- result : pandas.Series - frequency statistics for eigenvector centralities in a dataframe. + frequency statistics for eigenvector centralities in a Pandas DataFrame. """ if network == 'request_input': @@ -1439,7 +1453,7 @@ def eigencentralities_stats(self, network = 'request_input'): def authority_scores_df(self, network = 'request_input', weights=None, scale=True, return_eigenvalue=False): """ - Calculates Kleinberg's authority score for the vertices of the network. Returns a dataframe. + Calculates Kleinberg's authority score for the vertices of the network. Returns a Pandas DataFrame. Parameters ---------- @@ -1460,7 +1474,7 @@ def authority_scores_df(self, network = 'request_input', weights=None, scale=Tru Returns ------- result : pandas.DataFrame - the authority scores as a dataframe. + the authority scores as a Pandas DataFrame. """ if network == 'request_input': @@ -1485,7 +1499,7 @@ def authority_scores_df(self, network = 'request_input', weights=None, scale=Tru def authority_scores_stats(self, network = 'request_input', weights=None, scale=True, return_eigenvalue=False): """ - Returns frequency statistics for Kleinberg's authority score for the vertices of the network. Returns a dataframe. + Returns frequency statistics for Kleinberg's authority score for the vertices of the network. Returns a Pandas DataFrame. Parameters ---------- @@ -1506,7 +1520,7 @@ def authority_scores_stats(self, network = 'request_input', weights=None, scale= Returns ------- result : pandas.DataFrame - frequency statistics for authority scores as a dataframe. + frequency statistics for authority scores as a Pandas DataFrame. """ if network == 'request_input': @@ -1522,7 +1536,7 @@ def authority_scores_stats(self, network = 'request_input', weights=None, scale= def hub_scores_df(self, network = 'request_input', weights=None, scale=True, return_eigenvalue=False): """ - Calculates Kleinberg's hub score for the vertices of the graph. Returns a dataframe. + Calculates Kleinberg's hub score for the vertices of the graph. Returns a Pandas DataFrame. Parameters ---------- @@ -1543,7 +1557,7 @@ def hub_scores_df(self, network = 'request_input', weights=None, scale=True, ret Returns ------- result : pandas.DataFrame - the hub scores as a dataframe. + the hub scores as a Pandas DataFrame. """ if network == 'request_input': @@ -1568,7 +1582,7 @@ def hub_scores_df(self, network = 'request_input', weights=None, scale=True, ret def hub_scores_stats(self, network = 'request_input', weights=None, scale=True, return_eigenvalue=False): """ - Returns frequency statistisc for Kleinberg's hub score for the vertices of the graph. Returns a dataframe. + Returns frequency statistisc for Kleinberg's hub score for the vertices of the graph. Returns a Pandas DataFrame. Parameters ---------- @@ -1590,7 +1604,7 @@ def hub_scores_stats(self, network = 'request_input', weights=None, scale=True, Returns ------- result : pandas.DataFrame - frequency statistics for hub scores as a dataframe. + frequency statistics for hub scores as a Pandas DataFrame. """ if network == 'request_input': @@ -1606,7 +1620,7 @@ def hub_scores_stats(self, network = 'request_input', weights=None, scale=True, def coreness_df(self, network = 'request_input', mode='all'): """ - Finds the coreness (shell index) of the vertices of the network. Returns a dataframe. + Finds the coreness (shell index) of the vertices of the network. Returns a Pandas DataFrame. The M{k}-core of a graph is a maximal subgraph in which each vertex has at least degree k. (Degree here means the degree in the @@ -1794,7 +1808,7 @@ def decompose(self, network = 'request_input', mode='strong', maxcompno=None, mi def weighted_degrees_df(self, network = 'request_input', direction = 'all'): - """Calculates a network's weighted degrees and returns a dataframe.""" + """Calculates a network's weighted degrees and returns a Pandas DataFrame.""" if network == 'request_input': network = input('Network name: ') @@ -1847,7 +1861,7 @@ def weighted_degrees_stats(self, network = 'request_input', direction = 'all'): def degree_distribution(self, network = 'request_input', weighted = False, direction = 'all'): """ - Returns the network's weighted or unweighted degree distribution as a dataframe. + Returns the network's weighted or unweighted degree distribution as a Pandas DataFrame. """ if network == 'request_input': @@ -1869,74 +1883,22 @@ def degree_distribution(self, network = 'request_input', weighted = False, direc - def all_centralities(self, network = 'request_input', sort_by = ['weighted_degree','degree', 'betweenness','eigencentrality','authority_score','hub_score']): + def all_centralities(self, network = 'request_input'): """ - Calculates all centrality measures for network. Returns as a dataframe. + Calculates all centrality measures for network. Returns as a Pandas DataFrame. """ if network == 'request_input': network = input('Network name: ') network_obj = self.get_network(network) - is_directed = network_obj.is_directed() - - try: - degrees = self.degrees_df(network = network).set_index('vertex').sort_index() - except: - degrees = pd.DataFrame() - degrees.index.name = 'vertex' - - try: - weighted_degrees = self.weighted_degrees_df(network = network).set_index('vertex').sort_index() - except: - weighted_degrees = pd.DataFrame() - weighted_degrees.index.name = 'vertex' - - try: - eigencents = self.eigencentralities_df(network = network).set_index('vertex').sort_index() # type: ignore - except: - eigencents = pd.DataFrame() - eigencents.index.name = 'vertex' - - try: - betweenness = self.betweenness_df(network = network).set_index('vertex').sort_index() - except: - betweenness = pd.DataFrame() - betweenness.index.name = 'vertex' - - try: - auths = self.authority_scores_df(network = network).set_index('vertex').sort_index() - except: - auths = pd.DataFrame() - auths.index.name = 'vertex' - - try: - hubs = self.hub_scores_df(network = network).set_index('vertex').sort_index() - except: - hubs = pd.DataFrame() - hubs.index.name = 'vertex' - - combined = weighted_degrees.join( - degrees - ).join( - betweenness - ).join( - eigencents - ).join( - auths - ).join( - hubs) - - if is_directed == True: - sort_by = ['weighted_degree','degree', 'betweenness','authority_score','hub_score'] - - return combined.sort_values(sort_by, ascending=False) + return network_obj.all_centralities() def get_neighbours(self, network = 'request_input', vertex_name = 'request_input'): - """Returns vertex neighbours as a dataframe""" + """Returns vertex neighbours as a Pandas DataFrame""" if network == 'request_input': network = input('Network name: ') @@ -1949,7 +1911,7 @@ def get_neighbours(self, network = 'request_input', vertex_name = 'request_inpu # Get vertex vertex = network_obj.vs.find(name = vertex_name) - # Get vertex neighbours in a dataframe + # Get vertex neighbours in a Pandas DataFrame df = pd.DataFrame(columns = ['vertex_id', 'vertex_name']) @@ -2003,7 +1965,7 @@ def get_weighted_degree(self, network = 'request_input', vertex_name = 'request_ def get_item_all_degrees(self, item_id = 'request_input', weighted = False): """ - Returns a dataframe of degrees for all vertices representing an item. Takes an item ID. + Returns a Pandas DataFrame of degrees for all vertices representing an item. Takes an item ID. """ if item_id == 'request_input': diff --git a/art/networks/network_functions.py b/art/networks/network_functions.py index 757ab31..4b3bf43 100644 --- a/art/networks/network_functions.py +++ b/art/networks/network_functions.py @@ -627,7 +627,15 @@ def generate_funder_works_network(funder_works_dict: dict) -> Graph: return g def cocitation_dict(citation_network) -> dict: - + + """ + Generates a dictionary representing co-citations from a citation network. + + Notes + ----- + Is able to take igraph.Graph, Network, and NetworkX objects. + """ + # Converting NetworkX objects to igraph objects if ( (type(citation_network) == NetworkX_Undir)