Deleting arrows of a Quiver (GAP/QPA)

106 Views Asked by At

Given a quiver $Q$

Q  :=  Quiver(  1,  [  [1,1,"a"],  [1,1,"b"]  ]  );

I would like a new quiver $Q1$ deleting a arrow from quiver $Q$.

My attempts (trying to delete the arrow a):

Removeset(ArrowsOfQuiver(Q),Q.a);

SubtractSet(ArrowsOfQuiver(Q),Q.a);

ArrowsOfQuiver(Q) := Filtered(ArrowsOfQuiver(Q), r -> r <> Q.a);

Thank you very much!

2

There are 2 best solutions below

0
On BEST ANSWER

Here is one way of doing this in QPA:

gap> Q  :=  Quiver(  1,  [  [1,1,"a"],  [1,1,"b"]  ]  );                                                                        
<quiver with 1 vertices and 2 arrows>
gap> vQ := VerticesOfQuiver( Q );                                                                                               
[ v1 ]
gap> newarrows := Filtered( ArrowsOfQuiver( Q ), r -> r <> Q.a );                                                                
[ b ]
gap> newarrows := List( newarrows, a -> [ Position( vQ, SourceOfPath( a ) ), Position( vQ, TargetOfPath( a ) ), String( a ) ] );
[ [ 1, 1, "b" ] ]
gap> Q1 := Quiver( NumberOfVertices( Q ), newarrows );                                                                          
<quiver with 1 vertices and 1 arrows>
gap> ArrowsOfQuiver( Q1 );
[ b ]

The above can be used when newarrows is the arrows you want to keep in the new quiver Q1.

The problem is that the command Quiver does not take as an argument a list of arrows in a given quiver. One has to convert it to the allowed input format.

We hope that these comments are helpful.

The QPA-team.

1
On

I do not know about the specifics of the QPA package, but generically the GAP philosophy is that objects stay mathematically the same and that attribute values (such as ArrowsOfQuiver) cannot change. Thus, one could not change the object $Q$, but would have to create a new object with the desired properties.

With the caveat of not having the package installed, I guess that

Q1:=Quiver(1,Filtered(ArrowsOfQuiver(Q), r -> r <> Q.a));

would do the job.