def test4(self): # 1 # | # 4--0--2 # | # 3 adj = np.array([ [0, 1, 1, 1], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], ]) data = np.empty(4) assert_array_equal( graph_clusters_expanding(adj, threshold=1, iterations=1), np.array([0, 0, 0, 0])) assert_array_equal( graph_clusters_expanding(adj, threshold=2, iterations=1), np.array([0, 0, 0, 0])) assert_array_equal( graph_clusters_expanding(adj, threshold=3, iterations=1), np.array([-1, -1, -1, -1]))
def test4(self): # 1 # | # 4--0--2 # | # 3 adj = np.array([ [0, 1, 1, 1], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0], ]) data = np.empty(4) assert_array_equal( graph_clusters_expanding(adj, threshold=1, iterations=1), np.array([0, 0, 0, 0])) assert_array_equal( graph_clusters_expanding(adj, threshold=2, iterations=1), np.array([0, 0, 0, 0])) assert_array_equal( graph_clusters_expanding(adj, threshold=3, iterations=1), np.array([-1, -1, -1, -1]))
def test9(self): data = np.empty(9) assert_array_equal( graph_clusters_expanding(self.adj9, threshold=1, iterations=1), np.array([0, 0, 0, 0, 0, 1, 1, 1, 1])) assert_array_equal( graph_clusters_expanding(self.adj9, threshold=3, iterations=1), np.array([0, 0, 0, 0, 0, -1, -1, -1, -1])) assert_array_equal( graph_clusters_expanding(self.adj9, threshold=4, iterations=1), np.array([-1, -1, -1, -1, -1, -1, -1, -1, -1]))
def test9(self): data = np.empty(9) assert_array_equal( graph_clusters_expanding(self.adj9, threshold=1, iterations=1), np.array([0, 0, 0, 0, 0, 1, 1, 1, 1])) assert_array_equal( graph_clusters_expanding(self.adj9, threshold=3, iterations=1), np.array([0, 0, 0, 0, 0, -1, -1, -1, -1])) assert_array_equal( graph_clusters_expanding(self.adj9, threshold=4, iterations=1), np.array([-1, -1, -1, -1, -1, -1, -1, -1, -1]))
def test9limit1(self): assert_array_equal( graph_clusters_expanding(self.adj9, threshold=2, max_clusters=1, iterations=1), np.array([0, 0, 0, 0, 0, -1, -1, -1, -1]))
def test9expanding3(self): # first iteration clusters 0,1,2,3,4 # second iteration adds 5 # third iteration adds 6 assert_array_equal( graph_clusters_expanding(self.adj9, threshold=3, iterations=3), np.array([0, 0, 0, 0, 0, 0, 0, -1, -1]))
def test3(self): # 0--1--2 adj = np.array([ [0, 1, 0], [1, 0, 1], [0, 1, 0], ]) data = np.empty(3) assert_array_equal( graph_clusters_expanding(adj, threshold=1, iterations=1), np.array([0, 0, 0])) assert_array_equal( graph_clusters_expanding(adj, threshold=2, iterations=1), np.array([-1, -1, -1]))
def test9expanding3(self): # first iteration clusters 0,1,2,3,4 # second iteration adds 5 # third iteration adds 6 assert_array_equal( graph_clusters_expanding(self.adj9, threshold=3, iterations=3), np.array([0, 0, 0, 0, 0, 0, 0, -1, -1]))
def test3(self): # 0--1--2 adj = np.array([ [0, 1, 0], [1, 0, 1], [0, 1, 0], ]) data = np.empty(3) assert_array_equal( graph_clusters_expanding(adj, threshold=1, iterations=1), np.array([0, 0, 0])) assert_array_equal( graph_clusters_expanding(adj, threshold=2, iterations=1), np.array([-1, -1, -1]))
def test9limit1(self): assert_array_equal( graph_clusters_expanding(self.adj9, threshold=2, max_clusters=1, iterations=1), np.array([0, 0, 0, 0, 0, -1, -1, -1, -1]))
def test9expanding4(self): assert_array_equal( graph_clusters_expanding(self.adj9, threshold=3, iterations=4), np.array([0, 0, 0, 0, 0, 0, 0, 0, 0]))
def test9expanding4(self): assert_array_equal( graph_clusters_expanding(self.adj9, threshold=3, iterations=4), np.array([0, 0, 0, 0, 0, 0, 0, 0, 0]))