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.Fri, 06 Apr 2018 12:33:52 -0500temp22.sobj is not UTF-8 encodedhttp://ask.sagemath.org/question/41890/temp22sobj-is-not-utf-8-encoded/I get a temp22.sobj is not UTF-8 encoded after trying to open this file
I saved by using save(G.allsimplecycles, 'temp22') what am I doing wrong?
standardtrickynessFri, 06 Apr 2018 12:33:52 -0500http://ask.sagemath.org/question/41890/cycle indexhttp://ask.sagemath.org/question/10661/cycle-index/I know that S4 = SymmetricGroup(4)
P = S4.cycle_index()
will return the cycle index polynomial for S_4. What I want to do is substitute variables into this polynomial for Polya Enumeration problems. So for instance, how do I substitute x+y into the cycles of length 1, x^2+y^2 into the cycles of length 2, etc.ClemFanJC07Sat, 26 Oct 2013 12:31:51 -0500http://ask.sagemath.org/question/10661/Counting cycles of induced permutationshttp://ask.sagemath.org/question/31888/counting-cycles-of-induced-permutations/In order to do some sophisticated counting in graph theory, I need to count the cycles of some particular permutations.
In my situation, $n$ is an integer greater than 1, and $K_n$ is the set of all two-element sets {a,b} with $a, b$ being integers not greater than $n$. Now any element $\pi$ of the symmetric group $S_n$ induces a permutation $\overline{\pi}$ of $K_n$ in a natural way, i.e. $\overline{\pi}$ maps any set {a,b} of $K_n$ onto {$\pi(a)$, $\pi(b)$}. What I want to figure out with the help of SAGE is the number of cycles that the permutation $\overline{\pi}$ has.
If you can help me, please do not forget to mention those little extra things that need to be done and that might appear obvious to you (e.g. importing packages and so forth), since I am a relative novice to SAGE.
Thank you very much.
MalteMalteMon, 28 Dec 2015 10:56:15 -0600http://ask.sagemath.org/question/31888/How to get an arbitrary orientation of a graph.http://ask.sagemath.org/question/9835/how-to-get-an-arbitrary-orientation-of-a-graph/**I'VE COMPLETELY REVISED MY QUESTION**
I wish to take a simple undirected graph (i.e. the complete graph K_4)
Arbitrarily direct said graph, and then create a line graph from the directed version of the graph.
However, in Sage it appears to create a line graph that shows a connection between two edges (that are just inverses of each other), so what I really want is a line graph that doesn't give an edge connected to its own inverse.
**That's why I asked if we could remove cycles of length 2, but that doesn't seem to solve the problem.**
Here's what I am trying to work out:
G = graphs.RandomGNP(4,1)
GD = G.to_directed() #orients G
m = GD.size() #number of edges of digraph GD
LG = GD.line_graph() #the line graph of the digraph
IM = identity_matrix(QQ,GD.size())
T = LG.adjacency_matrix()#returns the adjacency matrix of the line graph
var('u') #defines u as a variable
X=IM-u*T #defines a new matrix X
Z=X.det() #defines polynomial in u aka inverse of the Ihara zeta function
Z #computes determinant of X
Z.coefficients(u) #extracts coefficients
considering my graph is a complete graph on 4 vertices - the coefficients should be as such:
[coeff,degree of u]
[1,0], [0,1], [0,2],[-8,3],[-2,4]
**NOTE:**
im only interested in coefficients up to the order of n=#of nodes in the graph, so here for K_4 obviously n=4.
where the coefficient of u^3 corresponds to the negative of twice the number of triangles in K_4
where the coefficient u^4 corresponds to the negative of twice the number of squares in K_4
**Here is an image of a K_4 graph minus an edge and the line graph construction of K_4 that i want**
![Here is an image of a K_4 graph minus an edge and the line graph construction of K_4 that i am after](http://dl.dropbox.com/u/2399196/graph.png)jtaaFri, 22 Feb 2013 13:59:05 -0600http://ask.sagemath.org/question/9835/Eulerian Cycle of a Digraphhttp://ask.sagemath.org/question/7844/eulerian-cycle-of-a-digraph/Hello,
Is there a function to do an Eulerian cycle of a digraph? eulerian_cycle works on undirected graphs, but not on digraphs. Basically I'm looking for an equivalent to Mathematica's EulerianCycle. Does this exist?
Thanks in advance.Eviatar BachThu, 06 Jan 2011 13:43:08 -0600http://ask.sagemath.org/question/7844/