# Path Algebras¶

class sage.quivers.algebra.PathAlgebra(k, P)

Create the path algebra of a quiver over a given field.

Given a quiver $$Q$$ and a field $$k$$, the path algebra $$kQ$$ is defined as follows. As a vector space it has basis the set of all paths in $$Q$$. Multiplication is defined on this basis and extended bilinearly. If $$p$$ is a path with terminal vertex $$t$$ and $$q$$ is a path with initial vertex $$i$$ then the product $$p*q$$ is defined to be the composition of the paths $$p$$ and $$q$$ if $$t = i$$ and $$0$$ otherwise.

INPUT:

• k – field (or commutative ring), the base field of the path algebra
• P – the path semigroup of a quiver $$Q$$

OUTPUT:

• the path algebra $$kP$$

EXAMPLES:

sage: P = DiGraph({1:{2:['a']}, 2:{3:['b']}}).path_semigroup()
sage: A = P.algebra(GF(7))
sage: A
Path algebra of Multi-digraph on 3 vertices over Finite Field of size 7
sage: A.variable_names()
('e_1', 'e_2', 'e_3', 'a', 'b')


Note that path algebras are uniquely defined by their quiver and field:

sage: A is P.algebra(GF(7))
True
sage: A is P.algebra(RR)
False
sage: A is DiGraph({1:{2:['a']}}).path_semigroup().algebra(GF(7))
False


The path algebra of an acyclic quiver has a finite basis:

sage: A.dimension()
6
sage: list(A.basis())
[e_1, e_2, e_3, a, b, a*b]


The path algebra can create elements from paths or from elements of the base ring:

sage: A(5)
5*e_1 + 5*e_2 + 5*e_3
sage: S = A.semigroup()
sage: S
Partial semigroup formed by the directed paths of Multi-digraph on 3 vertices
sage: p = S((1, 2, 'a'))
sage: r = S((2, 3, 'b'))
sage: e2 = S((2, 2))
sage: x = A(p) + A(e2)
sage: x
e_2 + a
sage: y = A(p) + A(r)
sage: y
a + b


Path algebras are graded algebras. The grading is given by assigning to each basis element the length of the path corresponding to that basis element:

sage: x.is_homogeneous()
False
sage: x.degree()
Traceback (most recent call last):
...
ValueError: Element is not homogeneous.
sage: y.is_homogeneous()
True
sage: y.degree()
1
sage: A[1]
Free module spanned by [a, b] over Finite Field of size 7
sage: A[2]
Free module spanned by [a*b] over Finite Field of size 7


TESTS:

sage: TestSuite(A).run()

class Element(M, x)

Create a combinatorial module element. This should never be called directly, but only through the parent combinatorial free module’s __call__() method.

TESTS:

sage: F = CombinatorialFreeModule(QQ, ['a','b','c'])
sage: B = F.basis()
sage: f = B['a'] + 3*B['c']; f
B['a'] + 3*B['c']
True

degree()

The degree of self, if self is homogeneous.

EXAMPLES:

sage: A = DiGraph({1:{2:['a', 'b']}, 2:{3:['c']}}).path_semigroup().algebra(QQ)
sage: A((1, 1)).degree()
0
sage: (A((1, 2, 'a')) + A((1, 2, 'b'))).degree()
1


An error is raised if the element is not homogeneous:

sage: (A((1, 1)) + A((1, 2, 'a'))).degree()
Traceback (most recent call last):
...
ValueError: Element is not homogeneous.

is_homogeneous()

Return True if and only if this element is homogeneous.

EXAMPLES:

sage: A = DiGraph({1:{2:['a', 'b']}, 2:{3:['c']}}).path_semigroup().algebra(QQ)
sage: (A((1, 2, 'a')) + A((1, 2, 'b'))).is_homogeneous()
True
sage: (A((1, 1)) + A((1, 2, 'a'))).is_homogeneous()
False

PathAlgebra.arrows()

Return the arrows of this algebra (corresponding to edges of the underlying quiver).

EXAMPLES:

sage: P = DiGraph({1:{2:['a']}, 2:{3:['b', 'c']}, 4:{}}).path_semigroup()
sage: A = P.algebra(GF(5))
sage: A.arrows()
(a, b, c)

PathAlgebra.degree_on_basis(p)

Return the degree of the monomial specified by the path p.

EXAMPLES:

sage: A = DiGraph({1:{2:['a']}, 2:{3:['b']}}).path_semigroup().algebra(QQ)
sage: A.degree_on_basis((1, 1))
0
sage: A.degree_on_basis((1, 2, 'a'))
1
sage: A.degree_on_basis([(1, 2, 'a'), (2, 3, 'b')])
2

PathAlgebra.gen(i)

Return the $$i$$-th generator of this algebra.

This is an idempotent (corresponding to a trivial path at a vertex) if $$i < n$$ (where $$n$$ is the number of vertices of the quiver), and a single-edge path otherwise.

EXAMPLES:

sage: P = DiGraph({1:{2:['a']}, 2:{3:['b', 'c']}, 4:{}}).path_semigroup()
sage: A = P.algebra(GF(5))
sage: A.gens()
(e_1, e_2, e_3, e_4, a, b, c)
sage: A.gen(2)
e_3
sage: A.gen(5)
b

PathAlgebra.gens()

Return the generators of this algebra (idempotents and arrows).

EXAMPLES:

sage: P = DiGraph({1:{2:['a']}, 2:{3:['b', 'c']}, 4:{}}).path_semigroup()
sage: A = P.algebra(GF(5))
sage: A.variable_names()
('e_1', 'e_2', 'e_3', 'e_4', 'a', 'b', 'c')
sage: A.gens()
(e_1, e_2, e_3, e_4, a, b, c)

PathAlgebra.homogeneous_component(n)

Return the $$n$$-th homogeneous piece of the path algebra.

INPUT:

• n – integer

OUTPUT:

EXAMPLES:

sage: P = DiGraph({1:{2:['a'], 3:['b']}, 2:{4:['c']}, 3:{4:['d']}}).path_semigroup()
sage: A = P.algebra(GF(7))
sage: A.homogeneous_component(2)
Free module spanned by [a*c, b*d] over Finite Field of size 7

sage: D = DiGraph({1: {2: 'a'}, 2: {3: 'b'}, 3: {1: 'c'}})
sage: P = D.path_semigroup()
sage: A = P.algebra(ZZ)
sage: A.homogeneous_component(3)
Free module spanned by [a*b*c, b*c*a, c*a*b] over Integer Ring

PathAlgebra.idempotents()

Return the idempotents of this algebra (corresponding to vertices of the underlying quiver).

EXAMPLES:

sage: P = DiGraph({1:{2:['a']}, 2:{3:['b', 'c']}, 4:{}}).path_semigroup()
sage: A = P.algebra(GF(5))
sage: A.idempotents()
(e_1, e_2, e_3, e_4)

PathAlgebra.ngens()

Number of generators of this algebra.

EXAMPLES:

sage: P = DiGraph({1:{2:['a']}, 2:{3:['b', 'c']}, 4:{}}).path_semigroup()
sage: A = P.algebra(GF(5))
sage: A.ngens()
7

PathAlgebra.one()

Return the multiplicative identity element.

The multiplicative identity of a path algebra is the sum of the basis elements corresponding to the trivial paths at each vertex.

EXAMPLES:

sage: A = DiGraph({1:{2:['a']}, 2:{3:['b']}}).path_semigroup().algebra(QQ)
sage: A.one()
e_1 + e_2 + e_3

PathAlgebra.product_on_basis(p1, p2)

Return the product p1*p2 in the path algebra.

INPUT:

• p1, p2 – QuiverPaths

OUTPUT:

EXAMPLES:

sage: Q = DiGraph({1:{2:['a']}, 2:{3:['b']}, 3:{4:['c']}}).path_semigroup()
sage: p1 = Q((1, 2, 'a'))
sage: p2 = Q([(2, 3, 'b'), (3, 4, 'c')])
sage: A = Q.algebra(QQ)
sage: A.product_on_basis(p1, p2)
a*b*c
sage: A.product_on_basis(p2, p1)
0

PathAlgebra.quiver()

Return the quiver from which the algebra self was formed.

OUTPUT:

• DiGraph, the quiver of the algebra

EXAMPLES:

sage: P = DiGraph({1:{2:[‘a’, ‘b’]}}).path_semigroup() sage: A = P.algebra(GF(3)) sage: A.quiver() is P.quiver() True
PathAlgebra.semigroup()

Return the (partial) semigroup from which the algebra self was constructed.

Note

The partial semigroup is formed by the paths of a quiver, multiplied by concatenation. If the quiver has more than a single vertex, then multiplication in the path semigroup is not always defined.

OUTPUT:

• the path semigroup from which self was formed (a partial semigroup)

EXAMPLES:

sage: P = DiGraph({1:{2:[‘a’, ‘b’]}}).path_semigroup() sage: A = P.algebra(GF(3)) sage: A.semigroup() is P True

Quivers

Quiver Homspace