Beispiel #1
0
class TestExtMETISGraphReader(unittest.TestCase):
    def setUp(self):
        from _NetworKit import Graph
        self.g = Graph(5)
        self.g.addEdge(0, 1)
        self.g.addEdge(0, 2)
        self.g.addEdge(0, 3)
        self.g.addEdge(0, 4)

    def test_readAndWrite(self):
        #		from networkit.graphio import METISGraphReader
        from _NetworKit import METISGraphReader
        from _NetworKit import METISGraphWriter
        w = METISGraphWriter()
        w.write(self.g, "output/metis_test.graph")
        self.assertTrue(os.path.isfile("output/metis_test.graph"))
        r = METISGraphReader()
        testg = r.read("output/metis_test.graph")
        self.assertEqual(self.g.numberOfNodes(), testg.numberOfNodes())
        self.assertEqual(self.g.numberOfEdges(), testg.numberOfEdges())
Beispiel #2
0
class TestExtMETISGraphReader(unittest.TestCase):
	def setUp(self):
		from _NetworKit import Graph
		self.g = Graph(5)
		self.g.addEdge(0,1)
		self.g.addEdge(0,2)
		self.g.addEdge(0,3)
		self.g.addEdge(0,4)

	def test_readAndWrite(self):
#		from networkit.graphio import METISGraphReader
		from _NetworKit import METISGraphReader
		from _NetworKit import METISGraphWriter
		w = METISGraphWriter()
		w.write(self.g, "output/metis_test.graph")
		self.assertTrue(os.path.isfile("output/metis_test.graph"))
		r = METISGraphReader()
		testg = r.read("output/metis_test.graph")
		self.assertEqual(self.g.numberOfNodes(), testg.numberOfNodes())
		self.assertEqual(self.g.numberOfEdges(), testg.numberOfEdges())
Beispiel #3
0
 def get_value(self, graph: Graph):
     self.logger.debug('Calculate node count')
     return [graph.numberOfNodes()]