### Navigation

- index
- modules |
- next |
- previous |
- Combinatorics »
- Cluster Algebras and Quivers »

# Quiver

A quiver is an oriented graphs without loops, two-cycles, or multiple edges. The edges are labelled by pairs \((i,-j)\) such that the matrix \(M = (m_{ab})\) with \(m_{ab} = i, m_{ba} = -j\) for an edge \((i,-j)\) between vertices \(a\) and \(b\) is skew-symmetrizable.

For the compendium on the cluster algebra and quiver package see

> http://arxiv.org/abs/1102.4844.

AUTHORS:

- Gregg Musiker
- Christian Stump

See also

For mutation types of combinatorial quivers, see `QuiverMutationType()`. Cluster seeds are closely related to `ClusterSeed()`.

class `sage.combinat.cluster_algebra_quiver.quiver.``ClusterQuiver`(data, frozen=None)

  Bases: `sage.structure.sage_object.SageObject`

  The quiver associated to an exchange matrix.

  INPUT:

  - `data` – can be any of the following:

        * QuiverMutationType
        * str - a string representing a QuiverMutationType or a common quiver type (see Examples)
        * ClusterQuiver
        * Matrix - a skew-symmetrizable matrix
        * DiGraph - must be the input data for a quiver
        * List of edges - must be the edge list of a digraph for a quiver

  - `frozen` – (default:`None`) sets the number of frozen variables if the input type is a DiGraph, it is ignored otherwise.

  EXAMPLES:

  > from a QuiverMutationType:

  >     sage: Q = ClusterQuiver(['A',5]); Q
  >     Quiver on 5 vertices of type ['A', 5]

  >     sage: Q = ClusterQuiver(['B',2]); Q
  >     Quiver on 2 vertices of type ['B', 2]
  >     sage: Q2 = ClusterQuiver(['C',2]); Q2
  >     Quiver on 2 vertices of type ['B', 2]
  >     sage: MT = Q.mutation_type(); MT.standard_quiver() == Q
  >     True
  >     sage: MT = Q2.mutation_type(); MT.standard_quiver() == Q2
  >     False

  >     sage: Q = ClusterQuiver(['A',[2,5],1]); Q
  >     Quiver on 7 vertices of type ['A', [2, 5], 1]

  >     sage: Q = ClusterQuiver(['A', [5,0],1]); Q
  >     Quiver on 5 vertices of type ['D', 5]
  >     sage: Q.is_finite()
  >     True
  >     sage: Q.is_acyclic()
  >     False

  >     sage: Q = ClusterQuiver(['F', 4, [2,1]]); Q
  >     Quiver on 6 vertices of type ['F', 4, [1, 2]]
  >     sage: MT = Q.mutation_type(); MT.standard_quiver() == Q
  >     False
  >     sage: dg = Q.digraph(); Q.mutate([2,1,4,0,5,3])
  >     sage: dg2 = Q.digraph(); dg2.is_isomorphic(dg,edge_labels=True)
  >     False
  >     sage: dg2.is_isomorphic(MT.standard_quiver().digraph(),edge_labels=True)
  >     True

  >     sage: Q = ClusterQuiver(['G',2, (3,1)]); Q
  >     Quiver on 4 vertices of type ['G', 2, [1, 3]]
  >     sage: MT = Q.mutation_type(); MT.standard_quiver() == Q
  >     False

  >     sage: Q = ClusterQuiver(['GR',[3,6]]); Q
  >     Quiver on 4 vertices of type ['D', 4]
  >     sage: MT = Q.mutation_type(); MT.standard_quiver() == Q
  >     False

  >     sage: Q = ClusterQuiver(['GR',[3,7]]); Q
  >     Quiver on 6 vertices of type ['E', 6]

  >     sage: Q = ClusterQuiver(['TR',2]); Q
  >     Quiver on 3 vertices of type ['A', 3]
  >     sage: MT = Q.mutation_type(); MT.standard_quiver() == Q
  >     False
  >     sage: Q.mutate([1,0]); MT.standard_quiver() == Q
  >     True

  >     sage: Q = ClusterQuiver(['TR',3]); Q
  >     Quiver on 6 vertices of type ['D', 6]
  >     sage: MT = Q.mutation_type(); MT.standard_quiver() == Q
  >     False

  > from a ClusterQuiver:

  >     sage: Q = ClusterQuiver(['A',[2,5],1]); Q
  >     Quiver on 7 vertices of type ['A', [2, 5], 1]
  >     sage: T = ClusterQuiver( Q ); T
  >     Quiver on 7 vertices of type ['A', [2, 5], 1]

  > from a Matrix:

  >     sage: Q = ClusterQuiver(['A',[2,5],1]); Q
  >     Quiver on 7 vertices of type ['A', [2, 5], 1]
  >     sage: T = ClusterQuiver( Q._M ); T
  >     Quiver on 7 vertices

  >     sage: Q = ClusterQuiver( matrix([[0,1,-1],[-1,0,1],[1,-1,0],[1,2,3]]) ); Q
  >     Quiver on 4 vertices with 1 frozen vertex

  >     sage: Q = ClusterQuiver( matrix([]) ); Q
  >     Quiver without vertices

  > from a DiGraph:

  >     sage: Q = ClusterQuiver(['A',[2,5],1]); Q
  >     Quiver on 7 vertices of type ['A', [2, 5], 1]
  >     sage: T = ClusterQuiver( Q._digraph ); T
  >     Quiver on 7 vertices

  >     sage: Q = ClusterQuiver( DiGraph([[1,2],[2,3],[3,4],[4,1]]) ); Q
  >     Quiver on 4 vertices

  > from a List of edges:

  >     sage: Q = ClusterQuiver(['A',[2,5],1]); Q
  >     Quiver on 7 vertices of type ['A', [2, 5], 1]
  >     sage: T = ClusterQuiver( Q._digraph.edges() ); T
  >     Quiver on 7 vertices

  >     sage: Q = ClusterQuiver( [[1,2],[2,3],[3,4],[4,1]] ); Q
  >     Quiver on 4 vertices

  TESTS:

      sage: Q = ClusterQuiver(DiGraph([[1,1]]))
      Traceback (most recent call last):
      ...
      ValueError: The input DiGraph contains a loop

      sage: Q = ClusterQuiver([[1,1]])
      Traceback (most recent call last):
      ...
      ValueError: The input DiGraph contains a loop

      sage: Q = ClusterQuiver(DiGraph([[1, 0],[0,1]]))
      Traceback (most recent call last):
      ...
      ValueError: The input DiGraph contains two-cycles

      sage: Q = ClusterQuiver('whatever')
      Traceback (most recent call last):
      ...
      ValueError: The input data was not recognized.

  `b_matrix`()

    Returns the b-matrix of `self`.

    EXAMPLES:

        sage: ClusterQuiver(['A',4]).b_matrix()
        [ 0  1  0  0]
        [-1  0 -1  0]
        [ 0  1  0  1]
        [ 0  0 -1  0]

        sage: ClusterQuiver(['B',4]).b_matrix()
        [ 0  1  0  0]
        [-1  0 -1  0]
        [ 0  1  0  1]
        [ 0  0 -2  0]

        sage: ClusterQuiver(['D',4]).b_matrix()
        [ 0  1  0  0]
        [-1  0 -1 -1]
        [ 0  1  0  0]
        [ 0  1  0  0]

        sage: ClusterQuiver(QuiverMutationType([['A',2],['B',2]])).b_matrix()
        [ 0  1  0  0]
        [-1  0  0  0]
        [ 0  0  0  1]
        [ 0  0 -2  0]

  `canonical_label`(certify=False)

    Returns the canonical labelling of `self`, see sage.graphs.graph.GenericGraph.canonical_label.

    INPUT:

    - `certify` – (default: False) if True, the dictionary from `self.vertices()` to the vertices of the returned quiver is returned as well.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',4]); Q.digraph().edges()
        [(0, 1, (1, -1)), (2, 1, (1, -1)), (2, 3, (1, -1))]

        sage: T = Q.canonical_label(); T.digraph().edges()
        [(0, 3, (1, -1)), (1, 2, (1, -1)), (1, 3, (1, -1))]

        sage: T,iso = Q.canonical_label(certify=True); T.digraph().edges(); iso
        [(0, 3, (1, -1)), (1, 2, (1, -1)), (1, 3, (1, -1))]
        {0: 0, 1: 3, 2: 1, 3: 2}

        sage: Q = ClusterQuiver(QuiverMutationType([['B',2],['A',1]])); Q
        Quiver on 3 vertices of type [ ['B', 2], ['A', 1] ]

        sage: Q.canonical_label()
        Quiver on 3 vertices of type [ ['A', 1], ['B', 2] ]

        sage: Q.canonical_label(certify=True)
        (Quiver on 3 vertices of type [ ['A', 1], ['B', 2] ], {0: 1, 1: 2, 2: 0})

  `digraph`()

    Returns the underlying digraph of `self`.

    EXAMPLES:

        sage: ClusterQuiver(['A',1]).digraph()
        Digraph on 1 vertex
        sage: ClusterQuiver(['A',1]).digraph().vertices()
        [0]
        sage: ClusterQuiver(['A',1]).digraph().edges()
        []

        sage: ClusterQuiver(['A',4]).digraph()
        Digraph on 4 vertices
        sage: ClusterQuiver(['A',4]).digraph().edges()
        [(0, 1, (1, -1)), (2, 1, (1, -1)), (2, 3, (1, -1))]

        sage: ClusterQuiver(['B',4]).digraph()
        Digraph on 4 vertices
        sage: ClusterQuiver(['A',4]).digraph().edges()
        [(0, 1, (1, -1)), (2, 1, (1, -1)), (2, 3, (1, -1))]

        sage: ClusterQuiver(QuiverMutationType([['A',2],['B',2]])).digraph()
        Digraph on 4 vertices

        sage: ClusterQuiver(QuiverMutationType([['A',2],['B',2]])).digraph().edges()
        [(0, 1, (1, -1)), (2, 3, (1, -2))]

  `exchangeable_part`()

    Returns the restriction to the principal part (i.e. exchangeable part) of `self`, the subquiver obtained by deleting the frozen vertices of `self`.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',4])
        sage: T = ClusterQuiver( Q.digraph().edges(), frozen=1 )
        sage: T.digraph().edges()
        [(0, 1, (1, -1)), (2, 1, (1, -1)), (2, 3, (1, -1))]

        sage: T.exchangeable_part().digraph().edges()
        [(0, 1, (1, -1)), (2, 1, (1, -1))]

        sage: Q2 = Q.principal_extension()
        sage: Q3 = Q2.principal_extension()
        sage: Q2.exchangeable_part() == Q3.exchangeable_part()
        True

  `interact`(fig_size=1, circular=True)

    Only in notebook mode. Starts an interactive window for cluster seed mutations.

    INPUT:

    - `fig_size` – (default: 1) factor by which the size of the plot is multiplied.
    - `circular` – (default: False) if True, the circular plot is chosen, otherwise >>spring<< is used.

    TESTS:

        sage: Q = ClusterQuiver(['A',4])
        sage: Q.interact() # long time
        'The interactive mode only runs in the Sage notebook.'

  `is_acyclic`()

    Returns true if `self` is acyclic.

    EXAMPLES:

        sage: ClusterQuiver(['A',4]).is_acyclic()
        True

        sage: ClusterQuiver(['A',[2,1],1]).is_acyclic()
        True

        sage: ClusterQuiver([[0,1],[1,2],[2,0]]).is_acyclic()
        False

  `is_bipartite`(return_bipartition=False)

    Returns true if `self` is bipartite.

    EXAMPLES:

        sage: ClusterQuiver(['A',[3,3],1]).is_bipartite()
        True

        sage: ClusterQuiver(['A',[4,3],1]).is_bipartite()
        False

  `is_finite`()

    Returns True if self is of finite type.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',3])
        sage: Q.is_finite()
        True
        sage: Q = ClusterQuiver(['A',[2,2],1])
        sage: Q.is_finite()
        False
        sage: Q = ClusterQuiver([['A',3],['B',3]])
        sage: Q.is_finite()
        True
        sage: Q = ClusterQuiver(['T',[4,4,4]])
        sage: Q.is_finite()
        False
        sage: Q = ClusterQuiver([['A',3],['T',[4,4,4]]])
        sage: Q.is_finite()
        False
        sage: Q = ClusterQuiver([['A',3],['T',[2,2,3]]])
        sage: Q.is_finite()
        True
        sage: Q = ClusterQuiver([['A',3],['D',5]])
        sage: Q.is_finite()
        True
        sage: Q = ClusterQuiver([['A',3],['D',5,1]])
        sage: Q.is_finite()
        False

        sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2]])
        sage: Q.is_finite()
        False

        sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2],[3,4,1],[4,5,1]])
        sage: Q.is_finite()
        False

  `is_mutation_finite`(nr_of_checks=None, return_path=False)

    Uses a non-deterministic method by random mutations in various directions. Can result in a wrong answer.

    INPUT:

    - `nr_of_checks` – (default: None) number of mutations applied. Standard is 500*(number of vertices of self).
    - `return_path` – (default: False) if True, in case of self not being mutation finite, a path from self to a quiver with an edge label (a,-b) and a*b > 4 is returned.

    ALGORITHM:

    A quiver is mutation infinite if and only if every edge label (a,-b) satisfy a*b > 4. Thus, we apply random mutations in random directions

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',10])
        sage: Q._mutation_type = None
        sage: Q.is_mutation_finite()
        True

        sage: Q = ClusterQuiver([(0,1),(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(7,8),(2,9)])
        sage: Q.is_mutation_finite()
        False

  `m`()

    Returns the number of frozen vertices of `self`.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',4])
        sage: Q.m()
        0

        sage: T = ClusterQuiver( Q.digraph().edges(), frozen=1 )
        sage: T.n()
        3
        sage: T.m()
        1

  `mutate`(data, inplace=True)

    Mutates `self` at a sequence of vertices.

    INPUT:

    - `sequence` – a vertex of `self` or an iterator of vertices of `self`.
    - `inplace` – (default: True) if False, the result is returned, otherwise `self` is modified.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',4]); Q.b_matrix()
        [ 0  1  0  0]
        [-1  0 -1  0]
        [ 0  1  0  1]
        [ 0  0 -1  0]

        sage: Q.mutate(0); Q.b_matrix()
        [ 0 -1  0  0]
        [ 1  0 -1  0]
        [ 0  1  0  1]
        [ 0  0 -1  0]

        sage: T = Q.mutate(0, inplace=False); T
        Quiver on 4 vertices of type ['A', 4]

        sage: Q.mutate(0)
        sage: Q == T
        True

        sage: Q.mutate([0,1,0])
        sage: Q.b_matrix()
        [ 0 -1  1  0]
        [ 1  0  0  0]
        [-1  0  0  1]
        [ 0  0 -1  0]

        sage: Q = ClusterQuiver(QuiverMutationType([['A',1],['A',3]]))
        sage: Q.b_matrix()
        [ 0  0  0  0]
        [ 0  0  1  0]
        [ 0 -1  0 -1]
        [ 0  0  1  0]

        sage: T = Q.mutate(0,inplace=False)
        sage: Q == T
        True

    TESTS:

        sage: Q = ClusterQuiver(['A',4]); Q.mutate(0,1)
        Traceback (most recent call last):
        ...
        ValueError: The second parameter must be boolean.  To mutate at a sequence of length 2, input it as a list.

        sage: Q = ClusterQuiver(['A',4]); Q.mutate(0,0)
        Traceback (most recent call last):
        ...
        ValueError: The second parameter must be boolean.  To mutate at a sequence of length 2, input it as a list.

  `mutation_class`(depth=+Infinity, show_depth=False, return_paths=False, data_type='quiver', up_to_equivalence=True, sink_source=False)

    Returns the mutation class of self together with certain constrains.

    INPUT:

    - `depth` – (default: infinity) integer, only seeds with distance at most depth from self are returned.

    - `show_depth` – (default: False) if True, the actual depth of the mutation is shown.

    - `return_paths` – (default: False) if True, a shortest path of mutation sequences from self to the given quiver is returned as well.

    - `data_type` – (default: “quiver”) can be one of the following:

          * "quiver" -- the quiver is returned
          * "dig6" -- the dig6-data is returned
          * "path" -- shortest paths of mutation sequences from self are returned

    - `sink_source` – (default: False) if True, only mutations at sinks and sources are applied.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',3])
        sage: Ts = Q.mutation_class()
        sage: for T in Ts: print T
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]

        sage: Ts = Q.mutation_class(depth=1)
        sage: for T in Ts: print T
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]

        sage: Ts = Q.mutation_class(show_depth=True)
        Depth: 0     found: 1          Time: ... s
        Depth: 1     found: 3          Time: ... s
        Depth: 2     found: 4          Time: ... s

        sage: Ts = Q.mutation_class(return_paths=True)
        sage: for T in Ts: print T
        (Quiver on 3 vertices of type ['A', 3], [])
        (Quiver on 3 vertices of type ['A', 3], [1])
        (Quiver on 3 vertices of type ['A', 3], [0])
        (Quiver on 3 vertices of type ['A', 3], [0, 1])

        sage: Ts = Q.mutation_class(up_to_equivalence=False)
        sage: for T in Ts: print T
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]

        sage: Ts = Q.mutation_class(return_paths=True,up_to_equivalence=False)
        sage: for T in Ts: print T
        (Quiver on 3 vertices of type ['A', 3], [])
        (Quiver on 3 vertices of type ['A', 3], [2])
        (Quiver on 3 vertices of type ['A', 3], [1])
        (Quiver on 3 vertices of type ['A', 3], [0])
        (Quiver on 3 vertices of type ['A', 3], [2, 1])
        (Quiver on 3 vertices of type ['A', 3], [0, 1])
        (Quiver on 3 vertices of type ['A', 3], [0, 1, 2])
        (Quiver on 3 vertices of type ['A', 3], [0, 1, 0])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 2])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 0])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 0, 2])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 0, 1])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 2, 1])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 2, 0])

        sage: Ts = Q.mutation_class(show_depth=True)
        Depth: 0     found: 1          Time: ... s
        Depth: 1     found: 3          Time: ... s
        Depth: 2     found: 4          Time: ... s

        sage: Ts = Q.mutation_class(show_depth=True, up_to_equivalence=False)
        Depth: 0     found: 1          Time: ... s
        Depth: 1     found: 4          Time: ... s
        Depth: 2     found: 6          Time: ... s
        Depth: 3     found: 10        Time: ... s
        Depth: 4     found: 14        Time: ... s

    TESTS:

        sage: all( len(ClusterQuiver(['A',n]).mutation_class()) == ClusterQuiver(['A',n]).mutation_type().class_size() for n in [2..6])
        True

        sage: all( len(ClusterQuiver(['B',n]).mutation_class()) == ClusterQuiver(['B',n]).mutation_type().class_size() for n in [2..6])
        True

  `mutation_class_iter`(depth=+Infinity, show_depth=False, return_paths=False, data_type='quiver', up_to_equivalence=True, sink_source=False)

    Returns an iterator for the mutation class of self together with certain constrains.

    INPUT:

    - `depth` – (default: infinity) integer, only quivers with distance at most depth from self are returned.

    - `show_depth` – (default: False) if True, the actual depth of the mutation is shown.

    - `return_paths` – (default: False) if True, a shortest path of mutation sequences from self to the given quiver is returned as well.

    - `data_type` – (default: “quiver”) can be one of the following:

          * "quiver"
          * "matrix"
          * "digraph"
          * "dig6"
          * "path"

    - `up_to_equivalence` – (default: True) if True, only one quiver for each graph-isomorphism class is recorded.

    - `sink_source` – (default: False) if True, only mutations at sinks and sources are applied.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',3])
        sage: it = Q.mutation_class_iter()
        sage: for T in it: print T
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]

        sage: it = Q.mutation_class_iter(depth=1)
        sage: for T in it: print T
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]

        sage: it = Q.mutation_class_iter(show_depth=True)
        sage: for T in it: pass
        Depth: 0     found: 1          Time: ... s
        Depth: 1     found: 3          Time: ... s
        Depth: 2     found: 4          Time: ... s

        sage: it = Q.mutation_class_iter(return_paths=True)
        sage: for T in it: print T
        (Quiver on 3 vertices of type ['A', 3], [])
        (Quiver on 3 vertices of type ['A', 3], [1])
        (Quiver on 3 vertices of type ['A', 3], [0])
        (Quiver on 3 vertices of type ['A', 3], [0, 1])

        sage: it = Q.mutation_class_iter(up_to_equivalence=False)
        sage: for T in it: print T
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]
        Quiver on 3 vertices of type ['A', 3]

        sage: it = Q.mutation_class_iter(return_paths=True,up_to_equivalence=False)
        sage: for T in it: print T
        (Quiver on 3 vertices of type ['A', 3], [])
        (Quiver on 3 vertices of type ['A', 3], [2])
        (Quiver on 3 vertices of type ['A', 3], [1])
        (Quiver on 3 vertices of type ['A', 3], [0])
        (Quiver on 3 vertices of type ['A', 3], [2, 1])
        (Quiver on 3 vertices of type ['A', 3], [0, 1])
        (Quiver on 3 vertices of type ['A', 3], [0, 1, 2])
        (Quiver on 3 vertices of type ['A', 3], [0, 1, 0])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 2])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 0])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 0, 2])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 0, 1])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 2, 1])
        (Quiver on 3 vertices of type ['A', 3], [2, 1, 2, 0])

        sage: Q = ClusterQuiver(['A',3])
        sage: it = Q.mutation_class_iter(data_type='path')
        sage: for T in it: print T
        []
        [1]
        [0]
        [0, 1]

        sage: Q = ClusterQuiver(['A',3])
        sage: it = Q.mutation_class_iter(return_paths=True,data_type='matrix')
        sage: it.next()
        (
        [ 0  0  1]
        [ 0  0  1]
        [-1 -1  0], []
        )

  `mutation_sequence`(sequence, show_sequence=False, fig_size=1.2)

    Returns a list containing the sequence of quivers obtained from `self` by a sequence of mutations on vertices.

    INPUT:

    - `sequence` – a list or tuple of vertices of `self`.
    - `show_sequence` – (default: False) if True, a png containing the mutation sequence is shown.
    - `fig_size` – (default: 1.2) factor by which the size of the sequence is expanded.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',4])
        sage: seq = Q.mutation_sequence([0,1]); seq
        [Quiver on 4 vertices of type ['A', 4], Quiver on 4 vertices of type ['A', 4], Quiver on 4 vertices of type ['A', 4]]
        sage: [T.b_matrix() for T in seq]
        [
        [ 0  1  0  0]  [ 0 -1  0  0]  [ 0  1 -1  0]
        [-1  0 -1  0]  [ 1  0 -1  0]  [-1  0  1  0]
        [ 0  1  0  1]  [ 0  1  0  1]  [ 1 -1  0  1]
        [ 0  0 -1  0], [ 0  0 -1  0], [ 0  0 -1  0]
        ]

  `mutation_type`()

    Returns the mutation type of `self`.

    Returns the mutation_type of each connected component of self if it can be determined, otherwise, the mutation type of this component is set to be unknown.

    The mutation types of the components are ordered by vertex labels.

    If you do many type recognitions, you should consider to save exceptional mutation types using \(meth\):sage.combinat.cluster_algebra_quiver.quiver_mutation_type.save_exceptional_data

    WARNING:

    - All finite types can be detected,
    - All affine types can be detected, EXCEPT affine type D (the algorithm is not yet implemented)
    - All exceptional types can be detected.

    EXAMPLES:

        sage: ClusterQuiver(['A',4]).mutation_type()
        ['A', 4]
        sage: ClusterQuiver(['A',(3,1),1]).mutation_type()
        ['A', [1, 3], 1]
        sage: ClusterQuiver(['C',2]).mutation_type()
        ['B', 2]
        sage: ClusterQuiver(['B',4,1]).mutation_type()
        ['BD', 4, 1]

    finite types:

        sage: Q = ClusterQuiver(['A',5])
        sage: Q._mutation_type = None
        sage: Q.mutation_type()
        ['A', 5]

        sage: Q = ClusterQuiver([(0,1),(1,2),(2,3),(3,4)])
        sage: Q.mutation_type()
        ['A', 5]

    affine types:

        sage: Q = ClusterQuiver(['E',8,[1,1]]); Q
        Quiver on 10 vertices of type ['E', 8, [1, 1]]
        sage: Q._mutation_type = None; Q
        Quiver on 10 vertices
        sage: Q.mutation_type() # long time
        ['E', 8, [1, 1]]

    the not yet working affine type D (unless user has saved small classical quiver data):

        sage: Q = ClusterQuiver(['D',4,1])
        sage: Q._mutation_type = None
        sage: Q.mutation_type() # todo: not implemented
        ['D', 4, 1]

    the exceptional types:

        sage: Q = ClusterQuiver(['X',6])
        sage: Q._mutation_type = None
        sage: Q.mutation_type() # long time
        ['X', 6]

    examples from page 8 of Keller’s article “Cluster algebras, quiver representations and triangulated categories” (arXiv:0807.1960):

        sage: dg = DiGraph(); dg.add_edges([(9,0),(9,4),(4,6),(6,7),(7,8),(8,3),(3,5),(5,6),(8,1),(2,3)])
        sage: ClusterQuiver( dg ).mutation_type() # long time
        ['E', 8, [1, 1]]

        sage: dg = DiGraph( { 0:[3], 1:[0,4], 2:[0,6], 3:[1,2,7], 4:[3,8], 5:[2], 6:[3,5], 7:[4,6], 8:[7] } )
        sage: ClusterQuiver( dg ).mutation_type() # long time
        ['E', 8, 1]

        sage: dg = DiGraph( { 0:[3,9], 1:[0,4], 2:[0,6], 3:[1,2,7], 4:[3,8], 5:[2], 6:[3,5], 7:[4,6], 8:[7], 9:[1] } )
        sage: ClusterQuiver( dg ).mutation_type() # long time
        ['E', 8, [1, 1]]

    infinite types:

        sage: Q = ClusterQuiver(['GR',[4,9]])
        sage: Q._mutation_type = None
        sage: Q.mutation_type()
        'undetermined infinite mutation type'

    reducible types:

        sage: Q = ClusterQuiver([['A', 3], ['B', 3]])
        sage: Q._mutation_type = None
        sage: Q.mutation_type()
        [ ['A', 3], ['B', 3] ]

        sage: Q = ClusterQuiver([['A', 3], ['T', [4,4,4]]])
        sage: Q._mutation_type = None
        sage: Q.mutation_type()
        [['A', 3], 'undetermined infinite mutation type']

        sage: Q = ClusterQuiver([['A', 3], ['B', 3], ['T', [4,4,4]]])
        sage: Q._mutation_type = None
        sage: Q.mutation_type()
        [['A', 3], ['B', 3], 'undetermined infinite mutation type']

        sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2],[3,4,1],[4,5,1]])
        sage: Q.mutation_type()
        ['undetermined finite mutation type', ['A', 3]]

    TESTS:

        sage: Q = ClusterQuiver(matrix([[0, 3], [-1, 0], [1, 0], [0, 1]]))
        sage: Q.mutation_type()
        ['G', 2]
        sage: Q = ClusterQuiver(matrix([[0, -1, -1, 1, 0], [1, 0, 1, 0, 1], [1, -1, 0, -1, 0], [-1, 0, 1, 0, 1], [0, -1, 0, -1, 0], [0, 1, 0, -1, -1], [0, 1, -1, 0, 0]]))
        sage: Q.mutation_type()
        'undetermined infinite mutation type'

  `n`()

    Returns the number of free vertices of `self`.

    EXAMPLES:

        sage: ClusterQuiver(['A',4]).n()
        4
        sage: ClusterQuiver(['A',(3,1),1]).n()
        4
        sage: ClusterQuiver(['B',4]).n()
        4
        sage: ClusterQuiver(['B',4,1]).n()
        5

  `plot`(circular=True, center=(0, 0), directed=True, mark=None, save_pos=False)

    Returns the plot of the underlying digraph of `self`.

    INPUT:

    - `circular` – (default:True) if True, the circular plot is chosen, otherwise >>spring<< is used.
    - `center` – (default:(0,0)) sets the center of the circular plot, otherwise it is ignored.
    - `directed` – (default: True) if True, the directed version is shown, otherwise the undirected.
    - `mark` – (default: None) if set to i, the vertex i is highlighted.
    - `save_pos` – (default:False) if True, the positions of the vertices are saved.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',5])
        sage: pl = Q.plot()
        sage: pl = Q.plot(circular=True)

  `principal_extension`(inplace=False)

    Returns the principal extension of `self`, adding n frozen vertices to any previously frozen vertices. I.e., the quiver obtained by adding an outgoing edge to every mutable vertex of `self`.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',2]); Q
        Quiver on 2 vertices of type ['A', 2]
        sage: T = Q.principal_extension(); T
        Quiver on 4 vertices of type ['A', 2] with 2 frozen vertices
        sage: T2 = T.principal_extension(); T2
        Quiver on 6 vertices of type ['A', 2] with 4 frozen vertices
        sage: Q.digraph().edges()
        [(0, 1, (1, -1))]
        sage: T.digraph().edges()
        [(0, 1, (1, -1)), (2, 0, (1, -1)), (3, 1, (1, -1))]
        sage: T2.digraph().edges()
        [(0, 1, (1, -1)), (2, 0, (1, -1)), (3, 1, (1, -1)), (4, 0, (1, -1)), (5, 1, (1, -1))]

  `qmu_save`(filename=None)

    Saves a .qmu file of `self` that can then be opened in Bernhard Keller’s Quiver Applet.

    INPUT:

    - `filename` – the filename the image is saved to.

    If a filename is not specified, the default name is from_sage.qmu in the current sage directory.

    EXAMPLES:

        sage: Q = ClusterQuiver(['F',4,[1,2]])
        sage: Q.qmu_save(os.path.join(SAGE_TMP, 'sage.qmu'))

    Make sure we can save quivers with \(m != n\) frozen variables, see trac ticket #14851:

        sage: S=ClusterSeed(['A',3])
        sage: T1=S.principal_extension()
        sage: T2=T1.principal_extension(ignore_coefficients=True)
        sage: Q=T2.quiver()
        sage: Q.qmu_save(os.path.join(SAGE_TMP, 'sage.qmu'))

  `reorient`(data)

    Reorients `self` with respect to the given total order, or with respect to an iterator of edges in `self` to be reverted.

    WARNING:

        This operation might change the mutation type of ``self``.

    INPUT:

    - `data` – an iterator defining a total order on `self.vertices()`, or an iterator of edges in `self` to be reoriented.

    EXAMPLES:

        sage: Q = ClusterQuiver(['A',(2,3),1])
        sage: Q.mutation_type()
        ['A', [2, 3], 1]

        sage: Q.reorient([(0,1),(1,2),(2,3),(3,4)])
        sage: Q.mutation_type()
        ['D', 5]

        sage: Q.reorient([0,1,2,3,4])
        sage: Q.mutation_type()
        ['A', [1, 4], 1]

  `save_image`(filename, circular=False)

    Saves the plot of the underlying digraph of `self`.

    INPUT:

    - `filename` – the filename the image is saved to.
    - `circular` – (default: False) if True, the circular plot is chosen, otherwise >>spring<< is used.

    EXAMPLES:

        sage: Q = ClusterQuiver(['F',4,[1,2]])
        sage: Q.save_image(os.path.join(SAGE_TMP, 'sage.png'))

  `show`(fig_size=1, circular=False, directed=True, mark=None, save_pos=False)

    Shows the plot of the underlying digraph of `self`.

    INPUT:

    - `fig_size` – (default: 1) factor by which the size of the plot is multiplied.
    - `circular` – (default: False) if True, the circular plot is chosen, otherwise >>spring<< is used.
    - `directed` – (default: True) if True, the directed version is shown, otherwise the undirected.
    - `mark` – (default: None) if set to i, the vertex i is highlighted.
    - `save_pos` – (default:False) if True, the positions of the vertices are saved.

    TESTS:

        sage: Q = ClusterQuiver(['A',5])
        sage: Q.show() # long time

### Navigation

- index
- modules |
- next |
- previous |
- Combinatorics »
- Cluster Algebras and Quivers »