ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 16 Apr 2022 19:05:57 +0200Finding all digraphs up to isomorphism for a given undirected graph using Sagehttps://ask.sagemath.org/question/62006/finding-all-digraphs-up-to-isomorphism-for-a-given-undirected-graph-using-sage/Given an undirected finite connected graph (without loops).
I have two questions:
1. Is there an easy way using Sage to obtain all ways to make it a directed graph (such that for each edge there is now one directed edge) up to isomorphism of graphs?
2. Is there an easy way using Sage to obtain all ways to make it a directed graph up to isomorphism of graphs and such that additionally the two opposite directed graphs get also identified?
Interesting examples might be graphs of Dynkin type such as E_8.
For $A_3$ for example in the first question there are 3 ways to make it into a directed graph.
In the second question there are two ways for $A_3$.
So the input should be a undirected finite connected graph and the output all possible orientations up to graph isomorphisms (and maybe up to taking the opposite graph as in question 2).klaaaSat, 16 Apr 2022 19:05:57 +0200https://ask.sagemath.org/question/62006/Problem visualizing graphs having Young tableaux at verticeshttps://ask.sagemath.org/question/60815/problem-visualizing-graphs-having-young-tableaux-at-vertices/I am trying to visualize the crystal graph associated to the tensor product of symmetric representations of a Kac-Moody algebra. An example of the code I am trying to run is the following.
sage: c=crystals.Tableaux('A2',shape=[2,1])
sage: G=c.digraph()
sage: view(G)
An error occurred.
...
Latex error
When called, the function view(G) gives a latex error, which I have not reported in its entirety. This seems to occur only in case the graph G has tableaux for vertices. In other instances, the function view seems to work fine. Is there a remedy to this issue? Should I install additional packages?
matteoWed, 26 Jan 2022 00:46:03 +0100https://ask.sagemath.org/question/60815/Finite categories?https://ask.sagemath.org/question/58033/finite-categories/Hi,
As part of a project on geometry of moduli of curves ('stacky fans') I'm trying to implement `categories with finitely many objects and finitely many morphisms'. I've started creating a class FiniteCat, but I can't decide whether it should be a child of DiGraph (where I add extra data of composition) , or of Category, using the existing machinery around that.
For context, I'm going to start with creating a FiniteCat from a lattice/poset (with maybe a couple of hundred vertices), then adding in a few more interesting (auto)morphisms). The main purpose is that I want to look at (pre)sheaves on these categories, check whether certain collections of data define sections of these presheaves, and perform basic operations on them.
Any suggestions would be very welcome .
Thanks,
David HolmesDavid HolmesFri, 16 Jul 2021 13:07:46 +0200https://ask.sagemath.org/question/58033/iterate over all directed acyclic graphs (DAGs) on n verticeshttps://ask.sagemath.org/question/56190/iterate-over-all-directed-acyclic-graphs-dags-on-n-vertices/Is there a simple way to iterate over all DAGs on n vertices?
So far, I do this via posets and gray code like shown below, but is it an overkill?
**UPDATE.** The code is corrected, thanks to *tmonteil*.
from sage.combinat.gray_codes import product as gc_product
def Dags0(n):
for P in Posets(n):
H = P.hasse_diagram()
E = list( set(H.transitive_closure().edges(labels=False)) - set(H.edges(labels=False)) )
G = H.copy()
C = G.canonical_label()
CC = set(C.dig6_string())
yield C
for e,d in gc_product([2]*len(E)):
if d>0:
G.add_edge(E[e])
else:
G.delete_edge(E[e])
C = G.canonical_label()
dig6 = C.dig6_string()
if dig6 not in CC:
CC.add(dig6)
yield CMax AlekseyevTue, 16 Mar 2021 21:23:41 +0100https://ask.sagemath.org/question/56190/Translating quiver in QPA to Sagehttps://ask.sagemath.org/question/55196/translating-quiver-in-qpa-to-sage/QPA is a GAP-package that deals with quiver algebras.
A quiver is just another word for directed graph.
My question is whether there is a quick way to translate the QPA-output of a quiver into a directed graph (with the same names for vertices and arrows) for Sage.
For example a quiver in QPA looks as follows:
Quiver( ["v1","v2","v3","v4","v5","v6","v7","v8"], [["v1","v1","a"],["v1","v2","b"],["v2","v3","c"],["v3","v4","d"],["v4","v5","e"],["v5","\v5","f"],["v3","v6","g"],["v6","v7","h"],["v7","v8","i"],["v8","v3","j"]] )
or as follows:
Quiver( ["v1","v2","v3"], [["v1","v2","a1"],["v2","v3","a2"],["v3","v1","a3"]] )
So the first list of the form `["v1","v2","v3","v4","v5","v6","v7","v8"]` are always the names of the vertices and the second list
[["v1","v1","a"],["v1","v2","b"],["v2","v3","c"],["v3","v4","d"],["v4","v5","e"],["v5","\v5","f"],["v3","v6","g"],["v6","v7","h"],["v7","v8","i"],["v8","v3","j"]]
are the names of the vertices, together with the information where they start and end. So for example `,["v2","v3","c"]` means that the arrow c starts at v2 and ends at v3.klaaaFri, 08 Jan 2021 19:09:19 +0100https://ask.sagemath.org/question/55196/