From 62a74ab5f25d521aeafc1e25af397dd6484677fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20D=C4=85browski?= Date: Wed, 14 Jun 2023 01:20:00 +0200 Subject: [PATCH 1/2] abstract method adding --- network_diffusion/seeding/betweenness_selector.py | 11 ++++++++++- network_diffusion/seeding/closeness_selector.py | 11 ++++++++++- network_diffusion/seeding/katz_selector.py | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/network_diffusion/seeding/betweenness_selector.py b/network_diffusion/seeding/betweenness_selector.py index 04853c9..cdf49ea 100644 --- a/network_diffusion/seeding/betweenness_selector.py +++ b/network_diffusion/seeding/betweenness_selector.py @@ -1,6 +1,8 @@ """A definition of the seed selector based on betweenness centrality.""" -from typing import List +from typing import Any, List + +import networkx as nx from network_diffusion.mln.actor import MLNetworkActor from network_diffusion.mln.functions import betweenness @@ -19,6 +21,13 @@ def __str__(self) -> str: f"\tbetweenness centrality choice\n{BOLD_UNDERLINE}\n" ) + @staticmethod + def _calculate_ranking_list(graph: nx.Graph) -> List[Any]: + """Create nodewise ranking.""" + raise NotImplementedError( + "Nodewise ranking list cannot be computed for this class!" + ) + def actorwise(self, net: MultilayerNetwork) -> List[MLNetworkActor]: """Get ranking for actors using betweenness centrality metric.""" ranking_list: List[MLNetworkActor] = [] diff --git a/network_diffusion/seeding/closeness_selector.py b/network_diffusion/seeding/closeness_selector.py index 6e23c16..5e53c73 100644 --- a/network_diffusion/seeding/closeness_selector.py +++ b/network_diffusion/seeding/closeness_selector.py @@ -18,7 +18,9 @@ """A definition of the seed selector based on closeness centrality.""" -from typing import List +from typing import Any, List + +import networkx as nx from network_diffusion.mln.actor import MLNetworkActor from network_diffusion.mln.functions import closeness @@ -37,6 +39,13 @@ def __str__(self) -> str: f"\tcloseness centrality choice\n{BOLD_UNDERLINE}\n" ) + @staticmethod + def _calculate_ranking_list(graph: nx.Graph) -> List[Any]: + """Create nodewise ranking.""" + raise NotImplementedError( + "Nodewise ranking list cannot be computed for this class!" + ) + def actorwise(self, net: MultilayerNetwork) -> List[MLNetworkActor]: """Get ranking for actors using closeness centrality metric.""" ranking_list: List[MLNetworkActor] = [] diff --git a/network_diffusion/seeding/katz_selector.py b/network_diffusion/seeding/katz_selector.py index e413323..71f67c0 100644 --- a/network_diffusion/seeding/katz_selector.py +++ b/network_diffusion/seeding/katz_selector.py @@ -18,7 +18,9 @@ """A definition of the seed selector based on Katz centrality.""" -from typing import List +from typing import Any, List + +import networkx as nx from network_diffusion.mln.actor import MLNetworkActor from network_diffusion.mln.functions import katz @@ -37,6 +39,13 @@ def __str__(self) -> str: f"\tkatz centrality choice\n{BOLD_UNDERLINE}\n" ) + @staticmethod + def _calculate_ranking_list(graph: nx.Graph) -> List[Any]: + """Create nodewise ranking.""" + raise NotImplementedError( + "Nodewise ranking list cannot be computed for this class!" + ) + def actorwise(self, net: MultilayerNetwork) -> List[MLNetworkActor]: """Get ranking for actors using Katz centrality metric.""" ranking_list: List[MLNetworkActor] = [] From 9144adbfa303aac28750ca5c82982edb76b03b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czuba?= Date: Tue, 5 Sep 2023 21:20:26 +0200 Subject: [PATCH 2/2] bumped version of the library --- network_diffusion/__init__.py | 2 +- submodules/template-python | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/network_diffusion/__init__.py b/network_diffusion/__init__.py index 762b427..6c7f168 100644 --- a/network_diffusion/__init__.py +++ b/network_diffusion/__init__.py @@ -27,4 +27,4 @@ from network_diffusion.mln.mlnetwork import MultilayerNetwork from network_diffusion.multi_spreading import MultiSpreading -__version__ = "0.10.0" +__version__ = "0.10.1" diff --git a/submodules/template-python b/submodules/template-python index 4f046d2..7901051 160000 --- a/submodules/template-python +++ b/submodules/template-python @@ -1 +1 @@ -Subproject commit 4f046d2fe3a4bba929ee9c5e0d08ddd5b0f9b792 +Subproject commit 79010513227bb4202e0c4db3f74f4779e00f887a