def setUp(self): self.partitions = [] graph = nx.Graph() nx.add_star(graph, range(20)) nx.add_path(graph, range(10)) self.partitions.append( NxPartitionGraphBased( graph, representation={node: node % 6 for node in graph})) graph = nx.DiGraph() nx.add_star(graph, range(20)) nx.add_path(graph, range(10)) self.partitions.append( NxPartitionGraphBased( graph, representation={node: node % 6 for node in graph})) self.uniform_icl_ex = IntegratedCompleteLikelihoodExact( is_directed=False, hyperprior=IntegratedCompleteLikelihoodExact.UNIFORM_HYPERPRIOR) self.jeffrey_icl_ex = IntegratedCompleteLikelihoodExact( is_directed=False, hyperprior=IntegratedCompleteLikelihoodExact.JEFFREY_HYPERPRIOR)
def setUp(self): self.partitions = [] # ring graph with 4 nodes graph = nx.DiGraph() nx.add_path(graph, [0, 1, 2, 3, 0]) self.partitions.append(NxPartitionGraphBased(graph, representation={node: node % 2 for node in graph})) # node counts 2, 2 # edge matrix # 0 2 # 2 0 # Ring Graph with selfloop graph = nx.DiGraph() nx.add_path(graph, [0, 1, 2, 3, 0, 0]) self.partitions.append(NxPartitionGraphBased(graph, representation={node: node % 2 for node in graph})) # node counts 2, 2 # edge matrix # 1 2 # 2 0 # graph with 3 groups graph = nx.DiGraph() nx.add_path(graph, [0, 1, 2, 3, 0, 4, 5, 6, 4]) self.partitions.append(NxPartitionGraphBased(graph, representation={0: 0, 1: 1, 2: 1, 3: 1, 4: 2, 5: 2, 6: 2})) # node counts 1, 3, 3 # edge matrix # 0 1 1 # 1 2 0 # 0 0 3 graph = nx.DiGraph(nx.karate_club_graph()) self.partitions.append(NxPartitionGraphBased(graph, representation={node: node % 5 for node in graph})) self._replace_likelihood = TraditionalUnnormalizedLogLikelyhood(is_directed=True)
def setUp(self): self.partitions = [] graph = nx.Graph() nx.add_star(graph, range(20)) nx.add_path(graph, range(10)) self.partitions.append(NxPartitionGraphBased(graph, representation={node: node % 6 for node in graph})) graph = nx.DiGraph() nx.add_star(graph, range(20)) nx.add_path(graph, range(10)) self.partitions.append(NxPartitionGraphBased(graph, representation={node: node % 6 for node in graph})) self.non_degree_corrected = NewmanReinertNonDegreeCorrected(is_directed=False) self.degree_corrected = NewmanReinertDegreeCorrected(is_directed=False)