Skip to content
Snippets Groups Projects
Commit 5865b354 authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Forgot to self env

parent e474611e
No related branches found
No related tags found
1 merge request!3Version 0.2
...@@ -2,6 +2,8 @@ import networkx as nx ...@@ -2,6 +2,8 @@ import networkx as nx
from .base import EpochCommunity from .base import EpochCommunity
# TODO: this is probably bugged, performs terribly for bubble
class KCliqueCommunity(EpochCommunity): class KCliqueCommunity(EpochCommunity):
def __init__(self, k=3, threshold=300, epoch=604800, **kwargs): def __init__(self, k=3, threshold=300, epoch=604800, **kwargs):
super().__init__(epoch, **kwargs) super().__init__(epoch, **kwargs)
...@@ -11,7 +13,7 @@ class KCliqueCommunity(EpochCommunity): ...@@ -11,7 +13,7 @@ class KCliqueCommunity(EpochCommunity):
def process(self, network): def process(self, network):
while True: while True:
yield self.tick() yield self.tick()
g = self.next_epoch(env.now) g = self.next_epoch(self.env.now)
G = nx.Graph() G = nx.Graph()
G.add_nodes_from(g.nodes()) G.add_nodes_from(g.nodes())
......
from collections import defaultdict
from community import best_partition as louvain_partition from community import best_partition as louvain_partition
from .base import EpochCommunity from .base import EpochCommunity
...@@ -11,7 +13,7 @@ class LouvainCommunity(EpochCommunity): ...@@ -11,7 +13,7 @@ class LouvainCommunity(EpochCommunity):
def process(self, network): def process(self, network):
while True: while True:
yield self.tick() yield self.tick()
g = self.next_epoch(env.now) g = self.next_epoch(self.env.now)
p = louvain_partition(g, weight='duration') p = louvain_partition(g, weight='duration')
communities = defaultdict(set) communities = defaultdict(set)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment