notebook.community
Edit and run
In [1]: import DSGRN from pychomp import *
import DSGRN from pychomp import *
In [2]: def dsgrn(pg, pi, method = "blowup"): p = pg.parameter(pi) if method == "original": dg = DSGRN.DomainGraph(p) md = DSGRN.MorseDecomposition(dg.digraph()) mg = DSGRN.MorseGraph(dg, md) return DSGRN.DrawGraph(mg) if method == "cubical": std = DSGRN.SubdomainGraph(p) elif method == "blowup": std = DSGRN.BlowupGraph(p) (dag, fibration)= ConleyMorseFibration(std.complex(), std.diagram()) connection_matrix = ConnectionMatrix(fibration) conleyindices = connection_matrix.count() fringenode = fibration.value(std.complex().size()-1) del conleyindices[fringenode] CMG = InducedPoset(dag, lambda v : v in conleyindices) return DrawFibration(connection_matrix, CMG)
def dsgrn(pg, pi, method = "blowup"): p = pg.parameter(pi) if method == "original": dg = DSGRN.DomainGraph(p) md = DSGRN.MorseDecomposition(dg.digraph()) mg = DSGRN.MorseGraph(dg, md) return DSGRN.DrawGraph(mg) if method == "cubical": std = DSGRN.SubdomainGraph(p) elif method == "blowup": std = DSGRN.BlowupGraph(p) (dag, fibration)= ConleyMorseFibration(std.complex(), std.diagram()) connection_matrix = ConnectionMatrix(fibration) conleyindices = connection_matrix.count() fringenode = fibration.value(std.complex().size()-1) del conleyindices[fringenode] CMG = InducedPoset(dag, lambda v : v in conleyindices) return DrawFibration(connection_matrix, CMG)
In [3]: def ComputeDatabase(netspec, params = None): network = DSGRN.Network(netspec) pg = DSGRN.ParameterGraph(network) if not params: params = range(0,pg.size()) return DSGRN.Table( ['ParameterIndex','Original', 'Cubical', 'Blowup'], [[pi, dsgrn(pg, pi, "original"), dsgrn(pg, pi, "cubical"), dsgrn(pg, pi, "blowup")] for pi in params])
def ComputeDatabase(netspec, params = None): network = DSGRN.Network(netspec) pg = DSGRN.ParameterGraph(network) if not params: params = range(0,pg.size()) return DSGRN.Table( ['ParameterIndex','Original', 'Cubical', 'Blowup'], [[pi, dsgrn(pg, pi, "original"), dsgrn(pg, pi, "cubical"), dsgrn(pg, pi, "blowup")] for pi in params])
In [4]: ComputeDatabase("X : ~Y\n Y : ~X\n")
ComputeDatabase("X : ~Y\n Y : ~X\n")
Out[4]: ParameterIndexOriginalCubicalBlowup0 %3 0 FP { 0, 0 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 1 %3 0 FP { 1, 0 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 2 %3 0 FP { 1, 0 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 3 %3 0 FP { 0, 1 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 4 %3 0 FP { 0, 1 } 1 FP { 1, 0 } %3 0 0 : (1, 0, 0) 1 11 : (0, 1, 0) 1->0 2 4 : (1, 0, 0) 1->2 %3 0 0 : (1, 0, 0) 1 1 : (1, 0, 0) 2 2 : (0, 1, 0) 2->0 2->1 5 %3 0 FP { 1, 0 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 6 %3 0 FP { 0, 1 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 7 %3 0 FP { 0, 1 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 8 %3 0 FP { 1, 1 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0)
In [5]: ComputeDatabase('X : X ~Y\n Y : ~X Y \n', params = [100, 102, 121, 122, 124, 126, 127, 128, 131, 132] )
ComputeDatabase('X : X ~Y\n Y : ~X Y \n', params = [100, 102, 121, 122, 124, 126, 127, 128, 131, 132] )
Out[5]: ParameterIndexOriginalCubicalBlowup100 %3 0 FP { 0, 1 } %3 0 0 : (1, 0, 0) %3 0 0 : (1, 0, 0) 102 %3 0 FP { 0, 1 } 1 FP { 1, 1 } %3 0 0 : (1, 0, 0) 1 9 : (1, 0, 0) 2 10 : (0, 1, 0) 2->0 2->1 %3 0 0 : (1, 0, 0) 1 2 : (1, 0, 0) 2 3 : (0, 1, 0) 2->0 2->1 121 %3 0 FP { 0, 0 } 1 FP { 0, 2 } 2 FP { 1, 0 } %3 0 0 : (1, 0, 0) 1 2 : (1, 0, 0) 2 19 : (0, 1, 0) 2->0 2->1 3 4 : (1, 0, 0) 4 5 : (0, 1, 0) 4->0 4->3 %3 0 0 : (1, 0, 0) 1 1 : (1, 0, 0) 2 2 : (1, 0, 0) 3 3 : (0, 1, 0) 3->0 3->2 4 9 : (0, 1, 0) 4->1 4->3 122 %3 0 FP { 0, 0 } 1 FP { 0, 2 } 2 FP { 1, 0 } 3 FP { 1, 2 } %3 0 0 : (1, 0, 0) 1 2 : (1, 0, 0) 2 4 : (1, 0, 0) 3 5 : (0, 1, 0) 3->0 3->2 4 68 : (0, 0, 1) 4->3 6 9 : (0, 1, 0) 4->6 7 17 : (0, 1, 0) 4->7 8 59 : (0, 1, 0) 4->8 5 8 : (1, 0, 0) 6->1 6->5 7->2 7->5 8->0 8->1 %3 0 0 : (1, 0, 0) 1 1 : (1, 0, 0) 2 2 : (1, 0, 0) 3 4 : (0, 1, 0) 3->0 3->2 4 9 : (1, 0, 0) 5 11 : (0, 1, 0) 5->3 5->4 6 15 : (0, 1, 0) 6->1 6->4 7 16 : (0, 1, 0) 7->1 7->3 8 19 : (0, 0, 1) 8->5 8->6 8->7 124 %3 0 FP { 0, 2 } 1 FP { 1, 0 } 2 FP { 1, 2 } %3 0 0 : (1, 0, 0) 1 19 : (0, 1, 0) 1->0 4 10 : (1, 0, 0) 1->4 2 8 : (1, 0, 0) 3 11 : (0, 1, 0) 3->2 3->4 5 72 : (0, 0, 1) 5->1 5->3 6 63 : (0, 1, 0) 5->6 6->0 6->2 %3 0 0 : (1, 0, 0) 1 17 : (0, 0, 1) 4 9 : (0, 1, 0) 1->4 5 13 : (0, 1, 0) 1->5 6 14 : (0, 1, 0) 1->6 2 5 : (1, 0, 0) 3 7 : (1, 0, 0) 4->0 4->3 5->2 5->3 6->0 6->2 126 %3 0 FP { 0, 0 } 1 FP { 0, 2 } 2 FP { 2, 0 } %3 0 0 : (1, 0, 0) 1 2 : (1, 0, 0) 2 4 : (1, 0, 0) 3 8 : (0, 1, 0) 3->0 3->2 4 25 : (0, 1, 0) 4->0 4->1 %3 0 0 : (1, 0, 0) 1 1 : (1, 0, 0) 2 2 : (1, 0, 0) 3 6 : (0, 2, 0) 3->0 3->1 3->2 127 %3 0 FP { 0, 0 } 1 FP { 0, 2 } 2 FP { 1, 2 } 3 FP { 2, 0 } %3 0 0 : (1, 0, 0) 1 2 : (1, 0, 0) 2 66 : (0, 0, 1) 4 8 : (0, 1, 0) 2->4 6 15 : (0, 1, 0) 2->6 7 25 : (0, 1, 0) 2->7 8 57 : (0, 1, 0) 2->8 3 4 : (1, 0, 0) 4->0 4->3 5 14 : (1, 0, 0) 6->1 6->5 7->3 7->5 8->0 8->1 %3 0 0 : (1, 0, 0) 1 1 : (1, 0, 0) 2 2 : (1, 0, 0) 3 5 : (0, 1, 0) 3->0 3->2 4 7 : (1, 0, 0) 5 8 : (0, 1, 0) 5->3 5->4 6 12 : (0, 1, 0) 6->1 6->4 7 13 : (0, 1, 0) 7->1 7->3 8 16 : (0, 0, 1) 8->5 8->6 8->7 128 %3 0 FP { 0, 0 } 1 FP { 0, 2 } 2 FP { 2, 0 } %3 0 0 : (1, 0, 0) 1 2 : (1, 0, 0) 2 50 : (0, 1, 0) 2->0 2->1 3 4 : (1, 0, 0) 4 68 : (0, 0, 1) 4->2 5 8 : (0, 1, 0) 4->5 6 28 : (0, 1, 0) 4->6 5->0 5->3 6->1 6->3 %3 0 0 : (1, 0, 0) 1 1 : (1, 0, 0) 2 2 : (1, 0, 0) 3 17 : (0, 0, 1) 5 12 : (0, 1, 0) 3->5 6 13 : (0, 1, 0) 3->6 4 7 : (0, 1, 0) 4->0 4->2 5->1 5->4 6->1 6->4 131 %3 0 FP { 1, 2 } 1 FP { 2, 0 } %3 0 0 : (1, 0, 0) 1 29 : (0, 1, 0) 1->0 2 14 : (1, 0, 0) 1->2 %3 0 0 : (1, 0, 0) 1 4 : (1, 0, 0) 2 7 : (0, 1, 0) 2->0 2->1 132 %3 0 FP { 0, 2 } 1 FP { 2, 0 } %3 0 0 : (1, 0, 0) 1 30 : (0, 1, 0) 1->0 4 14 : (1, 0, 0) 1->4 2 72 : (0, 0, 1) 2->1 3 56 : (0, 1, 0) 2->3 3->0 3->4 %3 0 0 : (1, 0, 0) 1 9 : (1, 0, 0) 2 10 : (0, 1, 0) 2->0 2->1 3 11 : (0, 1, 0) 3->0 3->1 4 15 : (0, 0, 1) 4->2 4->3
In [ ]: