Exemple #1
0
 def test_extract_cluster_level_topology(self):
     t = algorithms.IcnTopology(fnss.line_topology(6))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [set([0, 1]), set([2, 3]), set([4, 5])]
     algorithms.deploy_clusters(t, clusters)
     ct = algorithms.extract_cluster_level_topology(t)
     self.assertEqual(len(clusters), len(ct))
Exemple #2
0
 def test_extract_cluster_level_topology(self):
     t = algorithms.IcnTopology(fnss.line_topology(6))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [{0, 1}, {2, 3}, {4, 5}]
     algorithms.deploy_clusters(t, clusters)
     ct = algorithms.extract_cluster_level_topology(t)
     assert len(clusters) == len(ct)
Exemple #3
0
 def test_extract_cluster_level_topology(self):
     t = algorithms.IcnTopology(fnss.line_topology(6))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [set([0, 1]), set([2, 3]), set([4, 5])]
     algorithms.deploy_clusters(t, clusters)
     ct = algorithms.extract_cluster_level_topology(t)
     self.assertEqual(len(clusters), len(ct))
Exemple #4
0
 def test_extract_cluster_level_topology_1_cluster(self):
     t = algorithms.IcnTopology(fnss.line_topology(3))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [t.graph['icr_candidates']]
     algorithms.deploy_clusters(t, clusters)
     ct = algorithms.extract_cluster_level_topology(t)
     assert 1 == len(clusters)
     assert 1 == ct.number_of_nodes()
Exemple #5
0
 def test_extract_cluster_level_topology_1_cluster(self):
     t = algorithms.IcnTopology(fnss.line_topology(3))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [t.graph['icr_candidates']]
     algorithms.deploy_clusters(t, clusters)
     ct = algorithms.extract_cluster_level_topology(t)
     self.assertEqual(1, len(clusters))
     self.assertEqual(1, ct.number_of_nodes())
Exemple #6
0
 def test_deploy_clusters(self):
     t = algorithms.IcnTopology(fnss.line_topology(6))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [{0, 1}, {2, 3}, {4, 5}]
     cluster_map = {0: 0, 1: 0, 2: 1, 3: 1, 4: 2, 5: 2}
     algorithms.deploy_clusters(t, clusters)
     assert clusters == t.graph['clusters']
     for v, data in t.nodes(data=True):
         assert cluster_map[v] == data['cluster']
Exemple #7
0
 def test_deploy_clusters(self):
     t = algorithms.IcnTopology(fnss.line_topology(6))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [set([0, 1]), set([2, 3]), set([4, 5])]
     cluster_map = {0: 0, 1: 0, 2: 1, 3: 1, 4: 2, 5: 2}
     algorithms.deploy_clusters(t, clusters)
     self.assertEqual(clusters, t.graph['clusters'])
     for v, data in t.nodes(data=True):
         self.assertEqual(cluster_map[v], data['cluster'])
Exemple #8
0
 def test_deploy_clusters(self):
     t = algorithms.IcnTopology(fnss.line_topology(6))
     t.graph['icr_candidates'] = set(t.nodes())
     clusters = [set([0, 1]), set([2, 3]), set([4, 5])]
     cluster_map = {0: 0, 1: 0, 2: 1, 3: 1, 4: 2, 5: 2}
     algorithms.deploy_clusters(t, clusters)
     self.assertEqual(clusters, t.graph['clusters'])
     for v, data in t.nodes(data=True):
         self.assertEqual(cluster_map[v], data['cluster'])