Ask Your Question

JEA's profile - activity

2023-06-22 22:22:29 +0100 received badge  Notable Question (source)
2023-06-22 22:22:29 +0100 received badge  Popular Question (source)
2021-12-09 19:58:18 +0100 received badge  Famous Question (source)
2020-11-25 10:45:34 +0100 received badge  Popular Question (source)
2020-09-05 09:15:13 +0100 received badge  Notable Question (source)
2019-05-23 14:37:04 +0100 received badge  Popular Question (source)
2019-03-30 18:59:48 +0100 received badge  Notable Question (source)
2018-10-11 11:52:35 +0100 received badge  Popular Question (source)
2016-07-07 19:53:25 +0100 asked a question 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!

2016-06-02 16:13:15 +0100 commented answer Group Acting on a Set

Thank you!

2016-06-01 22:42:34 +0100 asked a question Group Acting on a Set

Say I have a list $V$ (or a set $V$; either would be fine) of 5-tuples; e.g.,

V = [(0,1,1,0,0), (1,0,0,1,1), (0,0,0,1,0)].

Is there a pre-defined function in Sage to create a list $W$ of all 5-tuples generated when the group $S_5$ of permutations of ${1,2,3,4,5}$ acts of $V$? If not, is there a relatively quick way that I could go about this?

2016-05-28 16:38:32 +0100 received badge  Supporter (source)
2016-05-28 02:00:45 +0100 commented answer How to define a graph using Cartesian coordinates

This was very helpful. Thank you!

2016-05-28 00:07:08 +0100 received badge  Student (source)
2016-05-27 23:08:39 +0100 received badge  Editor (source)
2016-05-27 23:08:03 +0100 asked a question How to define a graph using Cartesian coordinates

I am trying to figure out (1) how to input a graph into Sage where the vertices are described as Cartesian coordinates (3-tuples), and then (2) for each pair of vertices, compute the Euclidean distance between the two and, if the Euclidean distance is some fixed value $d$, add an edge between these two vertices.

Specifically, here are my questions:

  1. How do I input a graph into Sage where the vertices are described as Cartesian coordinates (3-tuples)?
  2. Is there a pre-defined function in Sage for computing the Euclidean distance between two Cartesian coordinates?
2016-05-23 18:37:14 +0100 commented answer Traceback error

Ahh, thank you! This helps a lot! And thanks to @FrédéricC and also to @tmonteil for their time.

2016-05-23 18:37:13 +0100 commented question Traceback error

I am sorry for my late reply. Here is the information. To answer @tmonteil:

  • I am using SageMath-7.1
  • OS X El Capitan
  • I don't know if Sage was installed from the binaries. The IT support staff for the department installed SageMath on these (department) computers.
  • Did I compile Sage myself? I'm sorry, I don't know what you mean.
  • I used Sage notebook
  • No, I did not use the command line.

To answer @FrédéricC: No, to my knowledge there was no output of sage M.

2016-05-23 18:24:53 +0100 received badge  Scholar (source)
2016-05-20 16:27:51 +0100 asked a question 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