Did I find the right examples for you? yes no

# sympy.categories.DiagramGrid

All Samples(86)  |  Call(80)  |  Derive(0)  |  Import(6)
Constructs and holds the fitting of the diagram into a grid.

The mission of this class is to analyse the structure of the
supplied diagram and to place its objects on a grid such that,
when the objects and the morphisms are actually drawn, the diagram
would be "readable", in the sense that there will not be many
intersections of moprhisms.  This class does not perform any
actual drawing.  It does strive nevertheless to offer sufficient
(more...)


from sympy.categories.diagram_drawing import _GrowableGrid, ArrowStringDescription
from sympy.categories import (DiagramGrid, Object, NamedMorphism,
Diagram, XypicDiagramDrawer, xypic_draw_diagram)
from sympy import FiniteSet


    # A one-morphism diagram.
d = Diagram([f])
grid = DiagramGrid(d)

assert grid.width == 2

    # A triangle.
d = Diagram([f, g], {g * f: "unique"})
grid = DiagramGrid(d)

assert grid.width == 2

    l_A = NamedMorphism(A, A, "l_A")
d = Diagram([f, g, l_A])
grid = DiagramGrid(d)

assert grid.width == 2

    # A simple diagram.
d = Diagram([f, g, h, k])
grid = DiagramGrid(d)

assert grid.width == 3


from sympy.categories.diagram_drawing import _GrowableGrid, ArrowStringDescription
from sympy.categories import (DiagramGrid, Object, NamedMorphism,
Diagram, XypicDiagramDrawer, xypic_draw_diagram)
from sympy import FiniteSet


    # A one-morphism diagram.
d = Diagram([f])
grid = DiagramGrid(d)

assert grid.width == 2

    # A triangle.
d = Diagram([f, g], {g * f: "unique"})
grid = DiagramGrid(d)

assert grid.width == 2

    l_A = NamedMorphism(A, A, "l_A")
d = Diagram([f, g, l_A])
grid = DiagramGrid(d)

assert grid.width == 2

    # A simple diagram.
d = Diagram([f, g, h, k])
grid = DiagramGrid(d)

assert grid.width == 3


def test_categories():
from sympy.categories import (Object, IdentityMorphism,
NamedMorphism, Category, Diagram, DiagramGrid)

A1 = Object("A1")

    g = NamedMorphism(B, C, "g")
d = Diagram([f, g])
grid = DiagramGrid(d)

assert latex(grid) == "\\begin{array}{cc}\n" \


def test_categories():
from sympy.categories import (Object, IdentityMorphism,
NamedMorphism, Category, Diagram, DiagramGrid)

A1 = Object("A1")

    g = NamedMorphism(B, C, "g")
d = Diagram([f, g])
grid = DiagramGrid(d)

assert latex(grid) == "\\begin{array}{cc}\n" \


def test_categories():
from sympy.categories import (Object, IdentityMorphism,
NamedMorphism, Category, Diagram, DiagramGrid)

A1 = Object("A1")

        " ══▶ {f₂∘f₁:A₁——▶A₃: {unique}}")

grid = DiagramGrid(d)
assert pretty(grid) == "A1  A2\n      \nA3    "
assert upretty(grid) == u("A₁  A₂\n      \nA₃    ")


def test_categories():
from sympy.categories import (Object, IdentityMorphism,
NamedMorphism, Category, Diagram, DiagramGrid)

A1 = Object("A1")

        " ══▶ {f₂∘f₁:A₁——▶A₃: {unique}}")

grid = DiagramGrid(d)
assert pretty(grid) == "A1  A2\n      \nA3    "
assert upretty(grid) == u("A₁  A₂\n      \nA₃    ")