diff --git a/src/sage/topology/cubical_complex.py b/src/sage/topology/cubical_complex.py index f060fcea8af..0ce508ec2c1 100644 --- a/src/sage/topology/cubical_complex.py +++ b/src/sage/topology/cubical_complex.py @@ -74,8 +74,6 @@ from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.matrix.constructor import matrix -from sage.homology.chain_complex import ChainComplex -from sage.graphs.graph import Graph from sage.misc.cachefunc import cached_method from sage.misc.superseded import deprecation from functools import total_ordering @@ -1192,6 +1190,8 @@ def chain_complex(self, subcomplex=None, augmented=False, sage: Square.homology(subcomplex=EdgesLTR)[2] == Square.homology(subcomplex=EdgesLBR)[2] True """ + from sage.homology.chain_complex import ChainComplex + # initialize subcomplex if subcomplex is None: subcomplex = CubicalComplex() @@ -1333,6 +1333,8 @@ def graph(self): sage: cubical_complexes.Sphere(2).graph() Graph on 8 vertices """ + from sage.graphs.graph import Graph + data = {} vertex_dict = {} i = 0 diff --git a/src/sage/topology/delta_complex.py b/src/sage/topology/delta_complex.py index bdc16265c68..012b92e351d 100644 --- a/src/sage/topology/delta_complex.py +++ b/src/sage/topology/delta_complex.py @@ -51,14 +51,11 @@ from copy import copy from sage.topology.cell_complex import GenericCellComplex -from sage.homology.chains import Chains, Cochains from sage.rings.integer_ring import ZZ from sage.rings.rational_field import QQ from sage.rings.integer import Integer from sage.matrix.constructor import matrix from .simplicial_complex import Simplex, lattice_paths, SimplicialComplex -from sage.homology.chain_complex import ChainComplex -from sage.graphs.graph import Graph from sage.arith.misc import binomial from sage.misc.cachefunc import cached_method @@ -630,6 +627,8 @@ def chain_complex(self, subcomplex=None, augmented=False, sage: T.homology(subcomplex=A) {0: 0, 1: 0, 2: Z} """ + from sage.homology.chain_complex import ChainComplex + if subcomplex is not None: # relative chain complex, so don't augment the chain complex augmented = False @@ -776,6 +775,8 @@ def graph(self): sage: delta_complexes.Simplex(4).graph() == graphs.CompleteGraph(5) True """ + from sage.graphs.graph import Graph + data = {} for vertex in range(len(self.n_cells(0))): data[vertex] = [] @@ -1523,6 +1524,8 @@ def n_chains(self, n, base_ring=None, cochains=False): sage: list(T.n_chains(1, QQ, cochains=True).basis()) [\chi_(0, (0, 0)), \chi_(1, (0, 0)), \chi_(2, (0, 0))] """ + from sage.homology.chains import Chains, Cochains + n_cells = tuple(enumerate(self.n_cells(n))) if cochains: return Cochains(self, n, n_cells, base_ring) diff --git a/src/sage/topology/simplicial_complex_morphism.py b/src/sage/topology/simplicial_complex_morphism.py index e8806f732ab..f788b47ccde 100644 --- a/src/sage/topology/simplicial_complex_morphism.py +++ b/src/sage/topology/simplicial_complex_morphism.py @@ -102,15 +102,13 @@ # # **************************************************************************** -from .simplicial_complex import Simplex, SimplicialComplex -from sage.matrix.constructor import matrix, zero_matrix -from sage.rings.integer_ring import ZZ -from sage.homology.chain_complex_morphism import ChainComplexMorphism -from sage.combinat.permutation import Permutation -from sage.algebras.steenrod.steenrod_algebra_misc import convert_perm -from sage.categories.morphism import Morphism from sage.categories.homset import Hom +from sage.categories.morphism import Morphism from sage.categories.simplicial_complexes import SimplicialComplexes +from sage.matrix.constructor import matrix, zero_matrix +from sage.rings.integer_ring import ZZ + +from .simplicial_complex import Simplex, SimplicialComplex def is_SimplicialComplexMorphism(x): @@ -252,6 +250,9 @@ def __call__(self,x,orientation=False): for j in tup: fx.append(self._vertex_dictionary[j]) if orientation: + from sage.algebras.steenrod.steenrod_algebra_misc import convert_perm + from sage.combinat.permutation import Permutation + if len(set(fx)) == len(tup): oriented = Permutation(convert_perm(fx)).signature() else: @@ -371,6 +372,8 @@ def associated_chain_complex_morphism(self,base_ring=ZZ,augmented=False,cochain= {0: [0 1] [1 0], 1: [-1]} """ + from sage.homology.chain_complex_morphism import ChainComplexMorphism + max_dim = max(self.domain().dimension(),self.codomain().dimension()) min_dim = min(self.domain().dimension(),self.codomain().dimension()) matrices = {} diff --git a/src/sage/topology/simplicial_set.py b/src/sage/topology/simplicial_set.py index 5612c1b352d..321442fdc8f 100644 --- a/src/sage/topology/simplicial_set.py +++ b/src/sage/topology/simplicial_set.py @@ -254,7 +254,6 @@ import copy -from sage.graphs.graph import Graph from sage.matrix.constructor import matrix from sage.misc.cachefunc import cached_method from sage.misc.fast_methods import WithEqualityById @@ -263,9 +262,6 @@ from sage.rings.rational_field import QQ from sage.structure.parent import Parent from sage.structure.sage_object import SageObject -from sage.homology.algebraic_topological_model import algebraic_topological_model_delta_complex -from sage.homology.chain_complex import ChainComplex -from sage.homology.chains import Chains, Cochains from .cell_complex import GenericCellComplex from .delta_complex import DeltaComplex @@ -1686,6 +1682,8 @@ def graph(self): sage: Sigma3.nerve().is_connected() True """ + from sage.graphs.graph import Graph + G = Graph(loops=True, multiedges=True) for e in self.n_cells(1): G.add_edge(self.face(e,0), self.face(e,1), e) @@ -2153,6 +2151,9 @@ def n_chains(self, n, base_ring=ZZ, cochains=False): return GenericCellComplex.n_chains(self, n=n, base_ring=base_ring, cochains=cochains) + + from sage.homology.chains import Chains, Cochains + n_cells = tuple(self.n_cells(n)) if cochains: return Cochains(self, n, n_cells, base_ring) @@ -3634,6 +3635,8 @@ def chain_complex(self, dimensions=None, base_ring=ZZ, augmented=False, sage: RP2.cohomology(base_ring=GF(2)) == SimplicialSet(RP2).cohomology(base_ring=GF(2)) True """ + from sage.homology.chain_complex import ChainComplex + if dimensions is None: if not self.cells(): # Empty if cochain: @@ -3782,6 +3785,8 @@ def algebraic_topological_model(self, base_ring=None): 1: Vector space of dimension 2 over Rational Field, 2: Vector space of dimension 1 over Rational Field} """ + from sage.homology.algebraic_topological_model import algebraic_topological_model_delta_complex + if base_ring is None: base_ring = QQ return algebraic_topological_model_delta_complex(self, base_ring) diff --git a/src/sage/topology/simplicial_set_constructions.py b/src/sage/topology/simplicial_set_constructions.py index 454a7334e0b..e5a14632098 100644 --- a/src/sage/topology/simplicial_set_constructions.py +++ b/src/sage/topology/simplicial_set_constructions.py @@ -74,7 +74,6 @@ import itertools -from sage.graphs.graph import Graph from sage.misc.latex import latex from sage.sets.set import Set from sage.structure.parent import Parent @@ -1417,6 +1416,8 @@ def __init__(self, maps=None, vertex_name=None): sage: PushoutOfSimplicialSets_finite([T.base_point_map(), S2.base_point_map()], vertex_name='v').n_cells(0)[0] v """ + from sage.graphs.graph import Graph + # Import this here to prevent circular imports. from sage.topology.simplicial_set_morphism import SimplicialSetMorphism if maps and any(not isinstance(f, SimplicialSetMorphism) for f in maps): diff --git a/src/sage/topology/simplicial_set_examples.py b/src/sage/topology/simplicial_set_examples.py index e81105a201f..0a5760d7a1f 100644 --- a/src/sage/topology/simplicial_set_examples.py +++ b/src/sage/topology/simplicial_set_examples.py @@ -34,7 +34,6 @@ from pyparsing import OneOrMore, nestedExpr from sage.env import SAGE_ENV -from sage.groups.abelian_gps.abelian_group import AbelianGroup from sage.misc.cachefunc import cached_method, cached_function from sage.misc.latex import latex from sage.rings.infinity import Infinity @@ -363,6 +362,8 @@ def RealProjectiveSpace(n): RP^{\infty} """ if n == Infinity: + from sage.groups.abelian_gps.abelian_group import AbelianGroup + X = AbelianGroup([2]).nerve() X.rename('RP^oo') X.rename_latex('RP^{\\infty}') diff --git a/src/sage/topology/simplicial_set_morphism.py b/src/sage/topology/simplicial_set_morphism.py index f74f5fe7685..263679c9254 100644 --- a/src/sage/topology/simplicial_set_morphism.py +++ b/src/sage/topology/simplicial_set_morphism.py @@ -39,8 +39,6 @@ from sage.misc.latex import latex from sage.rings.integer_ring import ZZ -from sage.homology.chain_complex_morphism import ChainComplexMorphism -from sage.homology.homology_morphism import InducedHomologyMorphism from .simplicial_set import SimplicialSet_arbitrary class SimplicialSetHomset(Homset): @@ -1312,6 +1310,8 @@ def associated_chain_complex_morphism(self, base_ring=ZZ, [-+-] [0|0] """ + from sage.homology.chain_complex_morphism import ChainComplexMorphism + # One or the other chain complex is trivial between these # dimensions: max_dim = max(self.domain().dimension(), self.codomain().dimension()) @@ -1394,6 +1394,8 @@ def induced_homology_morphism(self, base_ring=None, cohomology=False): [-+-] [0|2] """ + from sage.homology.homology_morphism import InducedHomologyMorphism + return InducedHomologyMorphism(self, base_ring, cohomology) def _repr_type(self):