https://github.com/kit-parco/networkit
Tip revision: 66548e5fc80394bfdfed7efdcf8bea770d268a6d authored by maxv on 10 November 2015, 19:30:55 UTC
version bump for automated generation of documentation
version bump for automated generation of documentation
Tip revision: 66548e5
test_community.py
import unittest
import os
from networkit import *
class Test_CommunityDetection(unittest.TestCase):
def setUp(self):
self.G = readGraph("input/PGPgiantcompo.graph",Format.METIS)
def test_PLM(self):
comms = community.detectCommunities(self.G, community.PLM(self.G))
# each node must be assigned
for v in self.G.nodes():
self.assertTrue(comms.contains(v))
def test_CutClustering(self):
jazz = readGraph("input/jazz.graph",Format.METIS)
cc = community.CutClustering(jazz,0.5076142131979697)
comms = community.detectCommunities(jazz, cc)
self.assertEqual(193, comms.numberOfSubsets())
hierarchy = community.CutClustering.getClusterHierarchy(jazz)
self.assertEqual(3, len(hierarchy))