Пример #1
0
 def __init__(self, model, logger, interval, mute_threshold):
     Demon.__init__(
             self,
             self.monitor_task, self.monitor_init, self.monitor_term,
             interval=interval, head_start=True)
     self.model = model
     self.logger = logger
     self.mute_threshold = mute_threshold
Пример #2
0
 def __init__(self, model, logger, interval, mute_threshold):
     Demon.__init__(self,
                    self.monitor_task,
                    self.monitor_init,
                    self.monitor_term,
                    interval=interval,
                    head_start=True)
     self.model = model
     self.logger = logger
     self.mute_threshold = mute_threshold
Пример #3
0
class FinalLevel():
    def __init__(self):
        self.screen = Screen(100, 30)
        self.paddle = Paddle(15, self.screen)
        self.ball = Ball(self.screen, self.paddle, False)
        self.paddle.place(self.paddle.size)
        self.ball.move()
    
    def placeDemon(self):
        self.demon = Demon(self.screen, self.paddle, self.ball)
        self.screen.setDemon(self.demon, self.paddle)
        self.ball.demon(self.demon)
        self.demon.place()
Пример #4
0
def demon(g_original, epsilon, min_com_size=3):
    """
    Demon is a node-centric bottom-up overlapping community discovery algorithm.
    It leverages ego-network structures and overlapping label propagation to identify micro-scale communities that are subsequently merged in mesoscale ones.

    :param g_original: a networkx/igraph object
    :param epsilon: merging threshold in [0,1], default 0.25.
    :param min_com_size: minimum community size, default 3.
    :return: NodeClustering object


    :Example:

    >>> from cdlib import algorithms
    >>> import networkx as nx
    >>> G = nx.karate_club_graph()
    >>> coms = algorithms.demon(G, min_com_size=3, epsilon=0.25)

    :References:

    1. Coscia, M., Rossetti, G., Giannotti, F., & Pedreschi, D. (2012, August). `Demon: a local-first discovery method for overlapping communities. <http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.721.1788&rep=rep1&type=pdf/>`_ In Proceedings of the 18th ACM SIGKDD international conference on Knowledge discovery and data mining (pp. 615-623). ACM.

    2. Coscia, M., Rossetti, G., Giannotti, F., & Pedreschi, D. (2014). `Uncovering hierarchical and overlapping communities with a local-first approach. <https://dl.acm.org/citation.cfm?id=2629511/>`_ ACM Transactions on Knowledge Discovery from Data (TKDD), 9(1), 6.

    .. note:: Reference implementation: https://github.com/GiulioRossetti/DEMON

    """

    g = convert_graph_formats(g_original, nx.Graph)

    with suppress_stdout():
        dm = Demon(graph=g, epsilon=epsilon, min_community_size=min_com_size)
        coms = dm.execute()
        coms = [list(c) for c in coms]

    return NodeClustering(coms,
                          g_original,
                          "DEMON",
                          method_parameters={
                              "epsilon": epsilon,
                              "min_com_size": min_com_size
                          },
                          overlap=True)
Пример #5
0
 def placeDemon(self):
     self.demon = Demon(self.screen, self.paddle, self.ball)
     self.screen.setDemon(self.demon, self.paddle)
     self.ball.demon(self.demon)
     self.demon.place()