Graphs - Category Framework

Skip to content
Back to top
View this page
Edit this page

# Graphs

class sage.categories.graphs.Graphs

  Bases: `Category_singleton`

  The category of graphs.

  EXAMPLES:

  Sage

      sage: from sage.categories.graphs import Graphs
      sage: C = Graphs(); C
      Category of graphs

  Python

      >>> from sage.all import *
      >>> from sage.categories.graphs import Graphs
      >>> C = Graphs(); C
      Category of graphs

  class Connected(base_category)

    Bases: `CategoryWithAxiom`

    The category of connected graphs.

    EXAMPLES:

    Sage

        sage: from sage.categories.graphs import Graphs
        sage: C = Graphs().Connected()
        sage: TestSuite(C).run()

    Python

        >>> from sage.all import *
        >>> from sage.categories.graphs import Graphs
        >>> C = Graphs().Connected()
        >>> TestSuite(C).run()

    extra_super_categories()

      Return the extra super categories of `self`.

      A connected graph is also a metric space.

      EXAMPLES:

      Sage

          sage: from sage.categories.graphs import Graphs
          sage: Graphs().Connected().super_categories() # indirect doctest
          [Category of connected topological spaces,
           Category of connected simplicial complexes,
           Category of graphs,
           Category of metric spaces]

      Python

          >>> from sage.all import *
          >>> from sage.categories.graphs import Graphs
          >>> Graphs().Connected().super_categories() # indirect doctest
          [Category of connected topological spaces,
           Category of connected simplicial complexes,
           Category of graphs,
           Category of metric spaces]

  class ParentMethods

    Bases: `object`

    dimension()

      Return the dimension of `self` as a CW complex.

      EXAMPLES:

      Sage

          sage: from sage.categories.graphs import Graphs
          sage: C = Graphs().example()
          sage: C.dimension()
          1

      Python

          >>> from sage.all import *
          >>> from sage.categories.graphs import Graphs
          >>> C = Graphs().example()
          >>> C.dimension()
          1

    edges()

      Return the edges of `self`.

      EXAMPLES:

      Sage

          sage: from sage.categories.graphs import Graphs
          sage: C = Graphs().example()
          sage: C.edges()
          [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]

      Python

          >>> from sage.all import *
          >>> from sage.categories.graphs import Graphs
          >>> C = Graphs().example()
          >>> C.edges()
          [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]

    faces()

      Return the faces of `self`.

      EXAMPLES:

      Sage

          sage: from sage.categories.graphs import Graphs
          sage: C = Graphs().example()
          sage: sorted(C.faces(), key=lambda x: (x.dimension(), x.value))
          [0, 1, 2, 3, 4, (0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]

      Python

          >>> from sage.all import *
          >>> from sage.categories.graphs import Graphs
          >>> C = Graphs().example()
          >>> sorted(C.faces(), key=lambda x: (x.dimension(), x.value))
          [0, 1, 2, 3, 4, (0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]

    facets()

      Return the facets of `self`.

      EXAMPLES:

      Sage

          sage: from sage.categories.graphs import Graphs
          sage: C = Graphs().example()
          sage: C.facets()
          [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]

      Python

          >>> from sage.all import *
          >>> from sage.categories.graphs import Graphs
          >>> C = Graphs().example()
          >>> C.facets()
          [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0)]

    vertices()

      Return the vertices of `self`.

      EXAMPLES:

      Sage

          sage: from sage.categories.graphs import Graphs
          sage: C = Graphs().example()
          sage: C.vertices()
          [0, 1, 2, 3, 4]

      Python

          >>> from sage.all import *
          >>> from sage.categories.graphs import Graphs
          >>> C = Graphs().example()
          >>> C.vertices()
          [0, 1, 2, 3, 4]

  super_categories()

    EXAMPLES:

    Sage

        sage: from sage.categories.graphs import Graphs
        sage: Graphs().super_categories()
        [Category of simplicial complexes]

    Python

        >>> from sage.all import *
        >>> from sage.categories.graphs import Graphs
        >>> Graphs().super_categories()
        [Category of simplicial complexes]