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.Wed, 03 Jul 2019 23:18:28 -0500How to count face on a bipartite graph?http://ask.sagemath.org/question/47057/how-to-count-face-on-a-bipartite-graph/I am graphing a bipartite graph but I need to rearrange the graph. The graph is generated by a list of list. One of the rearrangement guidelines is that the faces have to be surrounded by a certain amount of "white" vertices. Therefore, I wanted to create a checker function that can count the faces of the graph and count the "white" vertices around that face. If the graph doesn't have the correct amount of faces and/or the number of "white" vertices then the program will rearrange the graph. I would like some guidance on this task, what code/math I should use or if I should use a different approach. I have attached the code. If more information is needed to help, please contact me at cameron.dthomas@morehouse.edu
Thanks for your time,
Cameron Thomas
D={}
graph=Graph(D, multiedges=True)
def Dessin(S0, S1):
numVertices = len(S0)+len(S1)
G={}
#adds keys to G
for i in range(numVertices):
G[i]=(S0+S1)[i]
for i in range(len(S0)):
#print(S0[i])
for j in range(len(S0[i])):
#print(S0[i][j])
for k in range(len(S1)):
if S0[i][j] in S1[k]:
graph.add_edge(i,k + len(S0),S0[i][j])
print(G)
def color(S0, S1):
grey=[]
white=[]
for i in range(len(S0)):
grey.append(i)
for i in range(len(S1)):
white.append(i+len(S0))
return [grey,white]
Dessin(S0, S1)
color(S0, S1)
graph.graphplot(edge_labels=True, vertex_colors={'grey': color(S0,S1)[0],'white':color(S0,S1)[1]}, vertex_labels=True).show()
return(graph)
Graf([[1,5,4,3,2]],[[1],[2],[3],[4],[5]])CamDTho3Wed, 03 Jul 2019 23:18:28 -0500http://ask.sagemath.org/question/47057/find all matchings in a graphhttp://ask.sagemath.org/question/46964/find-all-matchings-in-a-graph/ Given a graph $G$, is it possible to ask Sage to generate all possible matchings of $G$? I know that G.matching() gives a maximum matching of $G$ and I also know that Sage has an iterator which finds all perfect matchings of $G$.
If no command exists which asks Sage to give me all possible matchings of $G$, does anyone have an idea of how to write a program to ask Sage to do this?merluzaFri, 21 Jun 2019 17:05:51 -0500http://ask.sagemath.org/question/46964/Create program to find which graphs contain specific subgraphhttp://ask.sagemath.org/question/45952/create-program-to-find-which-graphs-contain-specific-subgraph/ Hello, I am pretty new to Sage, and am discovering all the wonderful things it can do. I know how to ask Sage to generate a list of graphs that satisfy particular properties. To do this I "call" a program named "nauty". For example, if I would like to generate all graphs with 10 vertices, 25 edges, and clique number 4 I type the following:
sage: g10=[g for g in graphs.nauty_geng('10 25') if g.clique_number()==4]
Now say that I want to check which of these graphs contain a particular subgraph. For example, say I want to know which one of these graphs contain a 5-cycle. How can I ask Sage to go through the list of graphs in g10 and tell me this information?
Thank you in advance!merluzaSat, 30 Mar 2019 12:56:30 -0500http://ask.sagemath.org/question/45952/What are distance regular graphshttp://ask.sagemath.org/question/45960/what-are-distance-regular-graphs/ A connected graph Γ with diameter D is called distance-regular if there are constants ci,ai,bi — the so-called intersection numbers — such that for all i = 0,1,...,D, and all vertices x and y at distance i = d(x,y), among the neighbors ofy, there are ci at distance i−1 from x, ai at distance i, and bi at distance i+1. It follows that Γ is a regular graph with valency k = b0, and that ci +ai +bi = kfor all i = 0, 1, . . . , D. By these equations, the intersection numbers ai can be expressed in terms of the others, and it is standard to put these others in the so-called intersection array
{b0,b1,...,bD−1;c1,c2,...,cD}.VindieselwalkerSun, 31 Mar 2019 09:09:05 -0500http://ask.sagemath.org/question/45960/Building Graphs with Specific Properties Using Sagehttp://ask.sagemath.org/question/45944/building-graphs-with-specific-properties-using-sage/I would like to use Sage to build graphs with particular properties. I know how to call a program called "nauty" to ask Sage to generate, for example, all graphs on 8 vertices with 16 edges with clique number 4. However, I would like to add more properties.
Is it possible to have Sage generate all graphs with clique number 4 so that all vertices that are contained in a 4-clique satisfy a minimum degree condition? Or is it in general possible to have a particular subset of vertices satisfy a degree condition?
Thank you.merluzaFri, 29 Mar 2019 15:32:22 -0500http://ask.sagemath.org/question/45944/graph vertex labellinghttp://ask.sagemath.org/question/42892/graph-vertex-labelling/I have a graph (poset actually) that has a rational function labelling each vertex. I would like to show just the edges and the vertex labels. If I try to set `vertex_shape='None'` I get a crash deep in matplotlib. If I try anything else I get the marker symbol printed over the label. For example
P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white')
Will show the graph with circles over the labels. If I shrink the labels, then the edges cover the labels.
If I do
P = RootSystem(['A',3]).root_poset()
P.show(vertex_color='white', vertex_shape='None')
there is a strange crash.deinstTue, 10 Jul 2018 12:11:12 -0500http://ask.sagemath.org/question/42892/can you find the total chromatic number (edge and vertices) of a graph?http://ask.sagemath.org/question/35744/can-you-find-the-total-chromatic-number-edge-and-vertices-of-a-graph/I' m trying to find the total chromatic number of a graph and I was wondering if anyone knew how to do this? I have found the edge and vertex chromatic number but am unable to join the 2. livvy94Sat, 26 Nov 2016 08:00:14 -0600http://ask.sagemath.org/question/35744/How can I count the number of cycles of special length in a graph in sage?http://ask.sagemath.org/question/35837/how-can-i-count-the-number-of-cycles-of-special-length-in-a-graph-in-sage/I have tried the `G.subgraph_search_count(graphs.CycleGraph(4))`but it doesn't lead to the correct answer,
any help would be appreciated.M95Thu, 01 Dec 2016 02:07:54 -0600http://ask.sagemath.org/question/35837/Recursive Algorithm for Graph Coloringhttp://ask.sagemath.org/question/34051/recursive-algorithm-for-graph-coloring/In a 2014 article by Exoo, Ismailescu, and Lim ("On the Chromatic Number of R^4"), a recursive algorithm is described that verifies the absence of a proper $k$-coloring of a graph $G$. The authors include only the following description of the algorithm.
"[The program is] based on the following recursive procedure that does an exhaustive search for a $K$-coloring of a graph of order $N$. It employs a global variable *color*, an array of order $N$, which records the color of each vertex $v$ for $1 \leq v \leq N$. The search is initiated with the call DFS(1)."
procedure DFS(v):
Local variable: FCSet - the set of feasible colors for vertex v.
if v > N:
All vertices have been colored, report G is K-colorable.
Exit.
end if
FCSet = {1 ... K}
for u = 1 to v-1:
if u is adjacent to v:
FCSet = FCSet - color(u)
end if
end for
for c in FCSet:
color(v) = c
DFS(v+1)
end for
end procedure
I am having difficulty implementing this algorithm in Sage. Given the nature of the program, I thought Java would be a more natural programming language to use for this algorithm, but I'm afraid I am not familiar with Java syntax.
Any help with implementing this algorithm would be greatly appreciated! JEAThu, 07 Jul 2016 12:53:25 -0500http://ask.sagemath.org/question/34051/Traceback errorhttp://ask.sagemath.org/question/33456/traceback-error/ Hello,
I am new to Sage Math and new to this forum. Basically, I have written code to generate a specific graph on 10 vertices from its adjacency matrix. I am receiving an error (pasted below), but when my advisor runs the same exact code on his machine, he does not receive an error. I do not know how to resolve this situation. I've pasted my code below, and the error that I receive follows. Any insight would be much appreciated, and let me know if you need more details (e.g., information about the machine I'm using, operating system, etc.).
sage: M = Matrix([(0,0,1,0,1,1,1,0,1,1), (0,0,0,1,1,1,0,1,1,1), \
(1,0,0,1,1,1,1,0,0,0), (0,1,1,0,1,1,0,1,0,0), (1,1,1,1,0,1,0,0,1,0), \
(1,1,1,1,1,0,0,0,0,1), (1,0,1,0,0,0,0,1,1,1), (0,1,0,1,0,0,1,0,1,1), \
(1,1,0,0,1,0,1,1,0,1), (1,1,0,0,0,1,1,1,1,0)])
sage: M
[0 0 1 0 1 1 1 0 1 1]
[0 0 0 1 1 1 0 1 1 1]
[1 0 0 1 1 1 1 0 0 0]
[0 1 1 0 1 1 0 1 0 0]
[1 1 1 1 0 1 0 0 1 0]
[1 1 1 1 1 0 0 0 0 1]
[1 0 1 0 0 0 0 1 1 1]
[0 1 0 1 0 0 1 0 1 1]
[1 1 0 0 1 0 1 1 0 1]
[1 1 0 0 0 1 1 1 1 0]
sage: G = Graph(M); G
Graph on 10 vertices
sage: G.plot().show()
Here is the error.
Traceback (most recent call last): [0 0 0 1 1 1 0 1 1 1]
File "", line 1, in <module>
File "/private/var/folders/sw/0pqlf1452k58z_jbk3_yv5m97h2tyd/T/tmpabbyzH/___code___.py", line 5
G = Graph(M); G
^
SyntaxError: invalid syntax
JEAThu, 19 May 2016 14:56:50 -0500http://ask.sagemath.org/question/33456/How to import buckygenhttp://ask.sagemath.org/question/31381/how-to-import-buckygen/ I am struggling to find the way to import the Graph Theory library buckygen. Any suggestion? Thanks.andreaMon, 07 Dec 2015 11:26:47 -0600http://ask.sagemath.org/question/31381/Multiprocessing Maximal Cliques Enumerationhttp://ask.sagemath.org/question/27386/multiprocessing-maximal-cliques-enumeration/ Hy,
Is it a multiproccesor way to obtain a Maximal Cliques Enumeration (MCE) ?
I test maximal_cliques() (networkX and native) and maximum_cliques() but all of them use a one-cored algorythme too solve the Graph MCE.
Is it implemented? or am I looking for a dream?AlexJWed, 15 Jul 2015 09:12:02 -0500http://ask.sagemath.org/question/27386/checking isomorphism for weighted bipartite graphhttp://ask.sagemath.org/question/26130/checking-isomorphism-for-weighted-bipartite-graph/Hi, guys,
I am working on a problem involving checking if two weighted bipartite graphs are isomorphic.
I saw I can define a weighted graph in sage like this:
sage: X = Matrix([(0,0,1,1),(0,0,1,2),(0,1,1,0)])
sage: XX = BipartiteGraph(X,weighted=True)
sage: Y = Matrix([(1,0,2,0),(1,0,0,1),(1,0,1,0)])
sage: YY = BipartiteGraph(Y,weighted=True)
sage: W = Matrix([(1,0,2,0),(1,0,0,1),(1,0,2,0)])
sage: WW = BipartiteGraph(Z,weighted=True)
I swapped rows and columns of matrix defining X to get Y, so Y is isomorphic to X,
But since my graphs are weighted, I changed one element in Y from 1 to 2 to get W,
yet it still tell me XX and WW are isomorphic
sage: YY.is_isomorphic(XX)
True
sage: ZZ.is_isomorphic(XX)
True
Are there other functions I can use to check isomorphism for weighted bipartite graph?skylibraryTue, 10 Mar 2015 01:13:07 -0500http://ask.sagemath.org/question/26130/How to interpret the result of treewidth() function.http://ask.sagemath.org/question/25914/how-to-interpret-the-result-of-treewidth-function/ Hi there, I want to generate a random graph and compute the optimal treewidth, also the corresponding decomposition of this graph. Here is my code in sage:
g = graphs.RandomGNM(15, 50)
g.show()
g.treewidth(certificate=True)
The output as follows:
Graph on 7 vertices
I think this result should means in the optimal tree decomposition, there are 7 tree nodes. then my question is how can we get more detail information about which vertex of the graph belongs to which tree node of the decomposition?
Thanks for your attention!fetagTue, 24 Feb 2015 08:04:39 -0600http://ask.sagemath.org/question/25914/Generating all non-isomorphic bipartite graphs of certain partitionshttp://ask.sagemath.org/question/25864/generating-all-non-isomorphic-bipartite-graphs-of-certain-partitions/Hi everyone. I'm new here and I'm also new in using Sage. I hope someone here could help with what I am trying to do.
I would like to generate all non-isomorphic bipartite graphs given certain partitions. In other words, if $K_{(m,n)}$ is the complete bipartite graph with $m$ and $n$ being the number of vertices in each of its partitions, then what I would like to find is all the spanning subgraphs of $K_{(m,n)}$. These graphs would be bipartite and can be partitioned into two sets with one set having $m$ elements while the other have $n$.
That's it. How could I find all non-isomorphic bipartite graphs with bi-partitions of sizes $n$ and $m$ respectively?
Thank you!chowchingTue, 17 Feb 2015 21:04:45 -0600http://ask.sagemath.org/question/25864/setting default LP solverhttp://ask.sagemath.org/question/25455/setting-default-lp-solver/I installed Gurobi, and have gotten Sage to recognize it. So when I use a command such as vertex_coloring(G,solver="GUROBI") everything works fine.
But what if I want to use instead a command such as G.chromatic_number(algorithm="MILP"). How do I make sure that the LP solver that Sage is using is Gurobi, rather than GLPK? Is there one place I can tell Sage that it should always default to Gurobi as its LP solver, or is it possible that Sage is smart enough that once Gurobi is installed it does that anyway?
(Also, peripherally: does anyone have any idea whether chromatic_number or vertex_coloring is more efficient for large graphs?)
MattKahleFri, 09 Jan 2015 13:34:34 -0600http://ask.sagemath.org/question/25455/graph vertex labels placement or alignmenthttp://ask.sagemath.org/question/11349/graph-vertex-labels-placement-or-alignment/I made a sage Graph() for visualizing a bibliography and found that there was no good way to align or change the placement of the vertex labels.
I wanted some labels to align left and others to align right, but they were all centred on their vertex. I ended up doubling the length of the label string with spaces and adding a period with some code like the following
lDict = {}
for v in G.vertices():
if <test for the type of vertex>:
lDict[v] = v + len(v)*' ' + '.'
else:
lDict[v] = ''.join(['.',len(v)*' ',v])
G.relabel(lDict)
I managed to get this (click for full sized image):
[![Graph](http://alejandroerickson.com/home/blog/im/small_bibgraph.jpg)](http://alejandroerickson.com/home/blog/im/full_sized_bibgraph.png)
Is there a way to manipulate the placement of the labels?alejandroericksonMon, 31 Mar 2014 02:40:01 -0500http://ask.sagemath.org/question/11349/polya enumeration of non-isomorphic graphshttp://ask.sagemath.org/question/10750/polya-enumeration-of-non-isomorphic-graphs/I am trying to get Sage to give me the group acting on the potential edges of graph with n vertices for the purposes of Polya enumeration.
I know sage will give me the nth sysmmetric group, S_n. What I want is the group acting on the pairs, usually referred to as S_n^{(2)} in the literature. Any ideas?ClemFanJC07Mon, 18 Nov 2013 05:27:01 -0600http://ask.sagemath.org/question/10750/Problem with AbelianGroup.cayley_graph ()http://ask.sagemath.org/question/10490/problem-with-abeliangroupcayley_graph/Am I misunderstanding something here? `AbelianGroup.cayley_graph(`) fails with the default generators and but is ok if `generators=AbelianGroup.gens()`. It also fails with `.gens_small()`.
We have:
`sage: ag2=(AbelianGroup([3,3]))
sage: ag2.cayley_graph(generators=ag2.gens()))
Digraph on 9 vertices`
While:
`sage: ag2.cayley_graph() `
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-42-b5555c6dc56f> in <module>()
----> 1 ag2.cayley_graph()`
`/home/martin/sage-5.9/local/lib/python2.7/site-packages/sage/categories/semigroups.pyc in cayley_graph(self, side, simple, elements, generators, connecting_set)
283 generators = connecting_set
284 if generators is None:
--> 285 generators = self.semigroup_generators()
286 if isinstance(generators, (list, tuple)):
287 generators = dict((self(g), self(g)) for g in generators)`
`/home/martin/sage-5.9/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6585)()`
`/home/martin/sage-5.9/local/lib/python2.7/site-packages/sage/structure/misc.so in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1606)()`
`AttributeError: 'AbelianGroup_class_with_category' object has no attribute 'semigroup_generators'`
But ag2 is a semi_group:
`sage: ag2.categories()
[Category of groups,
Category of monoids,
Category of semigroups,
Category of magmas,
Category of sets,
Category of sets with partial maps,
Category of objects]`
QuestorsSat, 31 Aug 2013 10:09:18 -0500http://ask.sagemath.org/question/10490/Force Gap to forget graph automorphism groupshttp://ask.sagemath.org/question/10389/force-gap-to-forget-graph-automorphism-groups/I'm interested in computing and storing a huge number of graphs. For each graph I compute, I temporarily need to compute its automorphism group -- but I don't need to, and don't want to, remember that automorphism group. It looks like sage deals with graphs on its own but calls Gap to deal with automorphism groups.
The problem is that Gap, not sage, exceeds it permitted memory. Why? Here is a (silly) example of what I'm talking about: running
mylist=[];
count = 1;
while True:
g = graphs.RandomGNP(6, .5);
aut = g.automorphism_group();
mylist.append(g);
if aut.order() > 1:
print "Graph number %s has nontrivial automorphisms!"%(count);
count += 1;
gives me after some hours
RuntimeError: Gap produced error output
Error, exceeded the permitted memory (`-o' command line option)
How can I force sage/gap to forget the automorphism groups attached to the graphs (but remember the graphs)? Ideally Gap should only need to store one automorphism group at a time.MTFri, 26 Jul 2013 02:43:43 -0500http://ask.sagemath.org/question/10389/Labeling in graphshttp://ask.sagemath.org/question/10326/labeling-in-graphs/I am new to SAGE and am trying to experiment with it. What I am trying to do is something like this -
k = 1
G.add_edge((1,2), label= 'k')
Then it should label the edge as '1', not as 'k'. How would I do this?sanjithSat, 06 Jul 2013 09:02:35 -0500http://ask.sagemath.org/question/10326/Fonts in graph (graph theory) pictures are Type 3???http://ask.sagemath.org/question/9618/fonts-in-graph-graph-theory-pictures-are-type-3/I am writing my thesis. One requirement is I can not have any Type 3 fonts. My document does have Type 3 fonts (Go to File, Properties, then the Font tab in Adobe Reader to check) and I believe it is caused by the graphs I have drawn with Sage, which I save as PDFs and then include with \includegraphics in LaTeX. For example:
g=graphs.CycleGraph(5)
g.relabel(lambda i: i+1)
graph_plot = g.plot(talk=True)
graph_plot.save('5cycle.pdf')
It is listed as "BitstreamVeraSans-Roman". I am using the thesis LaTeX template provided by my university, and I have not added any statements that tell it to use a certain font anywhere, so I don't think it's possible that the Type 3 font is anywhere in my text, unless the person who made the template is a jerk.
That left me to guess it is in my pictures. I googled "bistream verasans roman sage" and came across [this question](http://ask.sagemath.org/question/1709/save-plot-in-svg-with-plain-text-strings) which suggests it is possible. I also deleted out 70% of my thesis, starting from the spot where the first figure appears, so that I deleted out all figures created as PDFs in Sage. And, now there are ***no*** Type 3 fonts.
Is it possible to change the font used? I guess it is the font used in labeling the vertices of the graphs??? Or, is it possible to explain why these fonts were used so I can try to explain why these fonts will not cause a problem? The reason we can not use Type 3 fonts is because [this website](http://www.ics.uci.edu/~chenli/pdf-font-types/index.html) says they cause problems, essentially that Type 1 fonts appear nicer when you are reading it on the screen.G-SageFri, 07 Dec 2012 07:45:26 -0600http://ask.sagemath.org/question/9618/Rotating positions of vertices (graph theory)http://ask.sagemath.org/question/9388/rotating-positions-of-vertices-graph-theory/Okay, in a [previous question](http://ask.sagemath.org/question/1757/strategies-for-drawing-good-graphs-graph-theory), I had asked how to draw nice graphs (graph theory). The answer was that the graph editor doesn't work any more so it's difficult, but a method was given that gave pretty good results. Using the techniques from that answer, I have the graph I want, except for the fact that I really want the picture rotated maybe 10 degrees counterclockwise. I'm trying to figure out how to do that.
One way I came up with, that doesn't really work, is to
angle = N(pi/18,50) #10 degrees
rot_matrix = matrix([[cos(angle), -sin(angle)],[sin(angle), cos(angle)]])
# The positions I have that need to be rotated
vert_pos={1: [0.8673592336550745, 0.8429750421487532], 2: [1.9428093163339426,
-0.8431329679383224], 3: [1.4051376567035885, 0.00014406801556917983],
4: [0.5620360593167806, -0.5378052476892125], 5: [2.2481442372671223,
0.5376447760675024], 6: [2.242709991911365, -0.18522591255842943], 7:
[1.219908082104656, -0.8375102818085887], 8: [1.5903441316845326,
0.8377000019696369], 9: [0.5674977685525984, 0.18521052179309053]}
# Hopefully, the positions that work perfectly!
new_pos = {}
for i in vert_pos: new_pos[i] = rot_matrix * i
graph_plot = g.plot(talk=True, pos=new_pos)
The problem is, instead of having an ordered pair, now I have a 2 by 1 matrix for each i. Is this method worthless? Or can it be saved? Or, I don't really care about using this method specifically, any one that works will do!G-SageThu, 04 Oct 2012 10:09:56 -0500http://ask.sagemath.org/question/9388/Distinct (nonisomorphic) treeshttp://ask.sagemath.org/question/9993/distinct-nonisomorphic-trees/"Construct all non-isomorphic trees of order 7"
How to do that in Sage ?!
Please helpMohabSun, 07 Apr 2013 07:24:14 -0500http://ask.sagemath.org/question/9993/Algorithm implementation in Sagehttp://ask.sagemath.org/question/9910/algorithm-implementation-in-sage/Input: Two undirected simple graphs G1 and G2, each having n vertices.
Output: `True` if G1 ? = G2; `False` otherwise.
for i ? 1,2 do
Ai ? adjacency matrix of Gi
pi ? permutation equivalence class of Ai
A0 i ? lexicographically maximal element of pi
if A0 1 = A0 2 then
return True
return False
anyone have any idea how to implement this in Sage ?MohabThu, 14 Mar 2013 00:22:04 -0500http://ask.sagemath.org/question/9910/How to get a graph back from canonical_label graph6_stringhttp://ask.sagemath.org/question/9606/how-to-get-a-graph-back-from-canonical_label-graph6_string/I have a list of graphs that I take their canonical_label 's graph6_string and then I save that list to a file.
Now I want to open that file and get sage graphs from the list of canonical_label graph6_string
How can I do it?
Thank you!dngraphTue, 04 Dec 2012 08:46:46 -0600http://ask.sagemath.org/question/9606/Graph editor doesn't workhttp://ask.sagemath.org/question/8447/graph-editor-doesnt-work/ h=graphs.ButterflyGraph()
graph_editor(h)
The result is the editor opens and the square the graph is supposed to be in is completely blank.
Sage 4.7.1, Firefox 7.0.1 running in notebook
When I click Save to see if that does anything, the result is the code graph_editor(h) is changed to:
h = Graph(}); h.set_pos(}); graph_editor(h);
which throws an error.
**UPDATE:** This appears to still not work in Sage 5.2 with Firefox 15. Can any one else confirm? Is there going to be any fix for this? Now, if I click Save, literally nothing happens. Doesn't work in IE9 either.${}$G-SageSun, 06 Nov 2011 05:56:58 -0600http://ask.sagemath.org/question/8447/Graph databasehttp://ask.sagemath.org/question/9501/graph-database/I know there is a built-in [graph database](http://www.sagemath.org/doc/reference/sage/graphs/graph_database.html). So, if I wanted to know the value of many different graph parameters for some small graph, I could just use the database to find them instead of having Sage calculate them. (or, at least in one case, Sage is actually unable to calculate them, e.g., Lovasz number).
But, I would like a similar thing for many of the named graphs built in to Sage (single graphs and families). Does anything exist? For example, if you try to calculate the chromatic number of the Higman Sims graph, it will take a very long time or may never finish. But, the value is likely known and it would be sweet if it were just built-in. Similarly, maybe the chromatic number of a complete multipartite graph. That is an obvious calculation but one that could take a very long time in Sage if there are many vertices. Is such a thing already built in? Or, is any one working on such things?G-SageMon, 05 Nov 2012 08:14:47 -0600http://ask.sagemath.org/question/9501/adjacency matrix importhttp://ask.sagemath.org/question/9473/adjacency-matrix-import/I am working on a social network analysis of sustainability staff at a large research university in the mid-west. I would like to keep track of my networks using a spreadsheet which will include information about connections (undirected or directed graphs) and information about the nodes (e.g. labels and groups).
Has anyone built scripts that will import generic csv files (or even better .xls or .numbers files)?
if I am being incredibly naive, please point me to the appropriate enlightenment.
thanks,
Lewis E GilbertLewisEGilbertFri, 26 Oct 2012 16:16:58 -0500http://ask.sagemath.org/question/9473/Create graphhttp://ask.sagemath.org/question/9440/create-graph/I want define new graph in sage. Let G be finite group. The graph's vertices are subgroup and two vertices are adjacent if and only if sum of two subgroup is G.
I have trouble with define this graph in sage. Any suggestion?
I have idea in gap but I don't have idea what can I change in sage?
Summands := function(G)
local n, i, sgl, l, A, B, D;
obtain a list of all subgroups
sgl := List(LatticeSubgroups(G)!.conjugacyClassesSubgroups, Representative);
n is the number of divisors of |G|
n := Size(DivisorsInt(Size(G)));
D := [];
if IsOddInt(n) then l := QuoInt(n + 1, 2);
else l := QuoInt(n, 2);
fi;
for i in [1..l] do
for A in Filtered(sgl, function(g) return Size(g) = DivisorsInt(Size(G))[i]; end) do
for B in Filtered(sgl, function(g) return Size(g) = DivisorsInt(Size(G))[n+1-i]; end) do
Add(D, [A, B]);
od;
od;
od;
return D;
end;
BabgenWed, 17 Oct 2012 05:17:15 -0500http://ask.sagemath.org/question/9440/