def runTest(self): graphs5 = GraphCollection('../graphs5.json') mg = MyGraph(dart_partitions=[ dict(z) for z in graphs5.select(id=20)[0]['dart_partitions'] ]) g_coll = GraphCollection('../graphs4.json') ors_coll = ORSCollection('../ors4.json') res = OrientedRotationSystem.inductive_from_mygraph( mg, g_coll, ors_coll) nonind = OrientedRotationSystem.from_mygraph(mg) self.assertEqual(len(res), len(nonind))
def runTest(self): g = MyGraph(**self.data["3-gon"]) h = MyGraph(**self.data["bouquet"]) self.collection.insert(g) self.collection.insert(h) self.collection.commit() coll = GraphCollection(self.fp) self.assertEqual(len(coll.data), 2)
def setUp(self): with open('fixtures/mygraphs.json', 'r') as jsonfile: self.data = json.load(jsonfile) self.fp = 'test_db.json' with open(self.fp, 'w+') as dbfile: json.dump([], dbfile) dbfile.close() self.collection = GraphCollection(self.fp)
def runTest(self): graphs4 = GraphCollection('../graphs4.json') graphs5 = GraphCollection('../graphs5.json') ors4 = ORSCollection('../ors4.json') results = [] count = 0 for row in graphs5.data: print(count) count += 1 g = MyGraph( dart_partitions=[dict(z) for z in row['dart_partitions']]) ir = OrientedRotationSystem.inductive_from_mygraph( g, graphs4, ors4) results += ir ors5 = ORSCollection('../testors5.json') embed() for r in results: ors5.insert(r, '../graphs5.json') ors5.commit() self.assertEqual(len(results), 23)
def runTest(self): g = graphs.CompleteGraph(5) g.delete_edge(0, 1) g.delete_edge(0, 2) mg = MyGraph(g.edges()) g_coll = GraphCollection('../graphs4.json') ors_coll = ORSCollection('../ors4.json') res = OrientedRotationSystem.inductive_from_mygraph( mg, g_coll, ors_coll) nonind = OrientedRotationSystem.from_mygraph(mg) self.assertEqual(len(res), len(nonind))
def runTest(self): graphs4 = GraphCollection('../graphs4.json') self.assertEqual(len(graphs4.data), 9) results = [] count = 0 for row in graphs4.data: count += 1 g = MyGraph( dart_partitions=[dict(z) for z in row['dart_partitions']]) ir = OrientedRotationSystem.from_mygraph(g) results += ir ors4 = ORSCollection('../testors4.json') for r in results: ors4.insert(r[0], '../graphs4.json') ors4.commit() self.assertEqual(len(results), 9)
from sparsity import MyGraph from graphcollections import GraphCollection import json raw7 = GraphCollection('raw7.json') fvs_list = [ tuple(x['degree_sequence']) for x in raw7.data] fvs_set = set(fvs_list) for y in fvs_set: x = list(y) l = raw7.select(degree_sequence=x) fn = "split/"+"_".join([str(i) for i in x])+".json" print("writing %s graphs to %s"%(str(len(l)),fn)) with open(fn,'w+') as jsonfile: json.dump(l,jsonfile)
from sparsity import MyGraph from graphcollections import GraphCollection graphs6 = GraphCollection('graphs6.json') a = [ MyGraph(dart_partitions=[dict(z) for z in x['dart_partitions']]) for x in graphs6.data ] b = MyGraph.extensions_of(a, no_iso_check=True) raw7 = GraphCollection('raw7.json') for g in b: raw7.insert(g) raw7.commit()
from sparsity import MyGraph from graphcollections import GraphCollection from IPython import embed raw7 = GraphCollection('raw7.json') a = [MyGraph(dart_partitions=[dict(z) for z in x['dart_partitions']]) for x in raw7.data] embed() out = MyGraph.isomorphism_class_reps(a,verbose=True) graphs7 = GraphCollection('graphs7.json') for g in out: graphs7.insert(g) graphs7.commit() embed()
from sparsity import MyGraph from graphcollections import GraphCollection a = [MyGraph(dart_partitions=[[[]],[]])] for i in range(6): print("computing graphs with %s vertices"%str(i+2)) a = MyGraph.extensions_of(a) fp = "mygraphs%s.json"%str(i+2) print("storing to %s"%fp) coll = GraphCollection(fp) for g in a: coll.insert(g) coll.commit()
from sparsity import MyGraph from graphcollections import GraphCollection raw7 = GraphCollection('raw7.json') fvs = { tuple(x['degree_sequence']) for x in raw7.data} for fv in fvs: fp = "split/"+"_".join([str(i) for i in fv])+".json" gc = GraphCollection(fp) gs = [MyGraph(dart_partitions=[dict(z) for z in x['dart_partitions']]) for x in gc.data] print("setifying list of %s graphs"%str(len(gs))) sfp = "split/set"+"_".join([str(i) for i in fv])+".json" sgc = GraphCollection(sfp) sgs = MyGraph.isomorphism_class_reps(gs,verbose=True) for g in sgs: sgc.insert(g) sgc.commit()