# Path: cache_management/LCE.py
# class LCE(CacheManager):
#     def __init__(self, cache_policy, cache_size, social_graph, topology, topology_manager, threshold = None):
#         super(LCE, self).__init__(cache_policy, cache_size, social_graph, topology, topology_manager, threshold)
#     def _init_strategy(self):
#         pass
#     def retrieve_from_caches(self, interest, path):
#         
#         content_found_caches = False
# 
#         for i in range(0, len(path)):
#             p = path[i]
#             if self.lookup_cache(p, interest):
#                 content_found_caches = True
#                 break
#             else:
#                 self.store_cache(p, interest)
# 
#         return (content_found_caches, i)


from cache_management.LCE import LCE
import networkx.algorithms.centrality
import numpy
#

class SACSEIGENVECTOR(LCE):
    def __init__(self, cache_policy, cache_size, social_graph, topology, topology_manager, threshold = None):
        super(SACSEIGENVECTOR, self).__init__(cache_policy, cache_size, social_graph, topology, topology_manager, threshold)
        self.eigenvector = networkx.algorithms.centrality.eigenvector_centrality(social_graph)
        self.threshold = numpy.average(self.eigenvector.values())

# Path: cache_management/LCE.py
# class LCE(CacheManager):
#     def __init__(self, cache_policy, cache_size, social_graph, topology, topology_manager, threshold = None):
#         super(LCE, self).__init__(cache_policy, cache_size, social_graph, topology, topology_manager, threshold)
#     def _init_strategy(self):
#         pass
#     def retrieve_from_caches(self, interest, path):
#         
#         content_found_caches = False
# 
#         for i in range(0, len(path)):
#             p = path[i]
#             if self.lookup_cache(p, interest):
#                 content_found_caches = True
#                 break
#             else:
#                 self.store_cache(p, interest)
# 
#         return (content_found_caches, i)


# Path: cache_management/SACSEIGENVECTOR.py
from cache_management.LCE import LCE
import networkx.algorithms.centrality
import numpy

#

class SACSEIGENVECTOR(LCE):
    def __init__(self, cache_policy, cache_size, social_graph, topology, topology_manager, threshold = None):
        super(SACSEIGENVECTOR, self).__init__(cache_policy, cache_size, social_graph, topology, topology_manager, threshold)
        self.eigenvector = networkx.algorithms.centrality.eigenvector_centrality(social_graph)
        self.threshold = numpy.average(self.eigenvector.values())

    def _post_production(self, content_name, social_publisher):