ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 21 Jan 2020 18:03:17 -0600Attempting to enrich quiver class yields "unexpected keyword argument" errorhttp://ask.sagemath.org/question/49636/attempting-to-enrich-quiver-class-yields-unexpected-keyword-argument-error/ I would like to do some computations with preprojective algebras, variations on the path algebra of a quiver in which every arrow has a partner going the other direction. I will want to construct representations of the "double quiver" in which I can conveniently compare the linear map associated to each arrow to that of its partner.
I figured I should create a class (something I haven't done in Python before) inheriting from DiGraph which has the extra data of a dictionary pairing the edges. My code to do this, with the constructor taking an arbitrary quiver and adding reversed copies of all the edges, is as follows:
class DoubleQuiver(sage.graphs.digraph.DiGraph):
def __init__(self, digraph):
edges = []
self._edgePairs = {}
for e in digraph.edges():
self._edgePairs[(e[0], e[1], e[2] + '0')] = (e[1], e[0], e[2] + '1')
self._edgePairs[(e[1], e[0], e[2] + '1')] = (e[0], e[1], e[2] + '0')
edges.append((e[0], e[1], e[2] + '0'))
edges.append((e[1], e[0], e[2] + '1'))
super(DoubleQuiver, self).__init__(edges, multiedges=True)
def flip(self, edge):
assert edge in self.edges()
return self._edgePairs[edge]
If I make a test digraph and run
DoubleQuiver(test)
it runs fine, and running methods like edges() or vertices() produces the results I expected. However, when I attempt to evaluate
DoubleQuiver(test).path_semigroup()
I get an error:
Error in lines 1-1
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute
flags=compile_flags), namespace, locals)
File "", line 1, in <module>
File "/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/sage/graphs/digraph.py", line 2511, in path_semigroup
return PathSemigroup(self)
File "sage/misc/classcall_metaclass.pyx", line 335, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1741)
return cls.classcall(cls, *args, **kwds)
File "/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/sage/quivers/path_semigroup.py", line 118, in __classcall__
Q = Q.copy(immutable=True, weighted=True)
File "/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 1206, in copy
data_structure=data_structure)
TypeError: __init__() got an unexpected keyword argument 'weighted'
How should I modify my class definition to avoid this error, or is there a better way of accomplishing what I'm trying to do? (Also, is it relevant that I'm trying this on CoCalc?)Will DanaTue, 21 Jan 2020 18:03:17 -0600http://ask.sagemath.org/question/49636/Betti numbers of Nakajima Quiver varietieshttp://ask.sagemath.org/question/47448/betti-numbers-of-nakajima-quiver-varieties/ Is it possible to compute betti numbers of Nakajima Quiver varieties using Sage?REKHA BISWALFri, 09 Aug 2019 06:22:51 -0500http://ask.sagemath.org/question/47448/Obtaining all connected simply laced graphs with Sage for GAPhttp://ask.sagemath.org/question/44747/obtaining-all-connected-simply-laced-graphs-with-sage-for-gap/I work with GAP and have not much experience with Sage. I wonder whether there is an easy way to obtain a program with Sage that gives as output a list of all directed simply laced acyclic connected graphs on n points up to equivalence that is readable for GAP (via the GAP-package QPA). I know that Sage can generate the list of such combinatorial collections in an easy way but I do not know how to present it in the needed output and how to obtain all restrictions on the graphs. With acyclic I mean acyclic as an directed graph (but in case this makes problems, you can also assume acyclic as undirected graphs).
Here a more detailed description of what the program should do:
Input: A natural number n >= 2.
Output: The list of directed simply laced acyclic connected graphs on n points up to equivalence. Here we call two such graphs equivalent in case they have the same underlying undirected graph (in case it is a problem to do it up to equivalence, we can first look at the problem without up to equivalence).
It is not important what the concrete orientation of the arrows of a representative in an equivalence class is.
Note that graphs are also often called quivers. GAP reads those graphs as `Quiver(n, [[p1, p2, "a1"], ...,[pm, pn, "ar"]])` where we name the points `pi` and the arrows between them as `aj` for some index sets `i` and `j`. (I hope it will be clear with the following examples).
Here how to output should look in the first 2 cases for n <= 3 so that it is readable for GAP:
n=2: `[Quiver(2,[[1,2,"a1"]])];`
n=3: `[Quiver(3,[[1,2,"a1"],[2,3,"a2"]]),Quiver(3,[[1,2,"a1"],[2,3,"a2"],[1,3,"a3"]])];` (note for example here here that the quiver `Quiver(3,[[1,2,"a1"],[2,3,"a2"]])` is equivalent to the quiver `Quiver(3,[[1,2,"a1"],[3,2,"a2"]])` since they are equal when looking at their undirected graphs)
So for n=2 there is one equivalence class, while for n=3 there are two (so that for n=3 the output is a list of two elements readable by GAP).sagequstionsSat, 22 Dec 2018 15:08:20 -0600http://ask.sagemath.org/question/44747/Drawing Auslander-Reiten quivers with sage possible?http://ask.sagemath.org/question/35638/drawing-auslander-reiten-quivers-with-sage-possible/Hi,
I'd like to draw an Auslander-Reiten quiver with sage. I tried to do this by viewing the Auslander-Reiten quiver as a digraph, but, unfortunately, I was not able to find out how to let sage draw both dashed and solid arrows in one digraph.
Is this possible? If not, is there another way to let sage draw Auslander-Reiten quivers?
Any help would be appreciated.
Edit:
I used the following code:
sage: H=DiGraph()
sage: H.add_edges([(2,1),(2,4),(10,4),(1,3),(4,3),(4,11),(11,6),(3,6),(3,5),(5,7),(6,7),(6,12)])
sage: H.add_edges([(7,8),(7,9),(12,9)])
After having typed
sage: H.show()
a few times I got the following output:
![pic1](/upfiles/1479480509763302.png)
Now, I'd like to draw dahed arrows indicating the Auslander-Reiten translates (e.g. a dashed arrow from 3 to 2).BernFri, 18 Nov 2016 07:49:43 -0600http://ask.sagemath.org/question/35638/