Ask Your Question

Captcha's profile - activity

2024-01-28 07:20:33 +0200 received badge  Famous Question (source)
2024-01-28 07:20:33 +0200 received badge  Notable Question (source)
2023-10-19 03:57:53 +0200 received badge  Popular Question (source)
2023-08-10 10:48:01 +0200 received badge  Notable Question (source)
2023-08-10 10:48:01 +0200 received badge  Popular Question (source)
2023-05-02 08:39:58 +0200 received badge  Famous Question (source)
2023-05-02 08:39:58 +0200 received badge  Notable Question (source)
2023-03-13 14:17:29 +0200 received badge  Notable Question (source)
2023-03-13 14:17:29 +0200 received badge  Popular Question (source)
2023-03-06 02:40:31 +0200 received badge  Notable Question (source)
2023-01-29 07:51:06 +0200 received badge  Famous Question (source)
2022-08-22 14:19:59 +0200 received badge  Nice Question (source)
2022-03-04 04:13:16 +0200 received badge  Notable Question (source)
2022-01-11 23:15:31 +0200 received badge  Popular Question (source)
2021-12-08 17:31:05 +0200 received badge  Popular Question (source)
2021-10-08 23:01:49 +0200 received badge  Popular Question (source)
2021-07-15 14:00:06 +0200 received badge  Popular Question (source)
2021-06-23 04:11:00 +0200 received badge  Famous Question (source)
2021-03-13 03:32:02 +0200 commented answer How to check if a graph has a given subgraph?

Thank you very much for such a detailed answer. Is there any method to find all the induced subgraphs isomorphic to H?

2021-03-13 03:29:01 +0200 commented answer How to check if a graph has a given subgraph?

Thank you very much for such a detailed answer!!!

2021-03-13 03:28:40 +0200 marked best answer How to check if a graph has a given subgraph?

Consider the Petersen graph G. I want to check if G has a given graph H as an induced subgraph or not. Is it possible to check this? I am new to SageMath.

I wrote this:

G = graphs.PetersenGraph()
H = Graph({1: [2, 3, 4]})

How to check if H is an induced subgraph of G or not?

2021-03-13 03:28:38 +0200 received badge  Supporter (source)
2021-03-12 16:11:15 +0200 edited question How to check if a graph has a given subgraph?

How to check if a graph has a given subgraph? Suppose I consider the Petersen graph G. I want to check if G has the foll

2021-03-12 16:10:53 +0200 asked a question How to check if a graph has a given subgraph?

How to check if a graph has a given subgraph? Suppose I consider the Petersen graph G. I want to check if G has the foll

2020-12-13 13:41:59 +0200 received badge  Popular Question (source)
2020-11-27 08:48:10 +0200 asked a question How to find sum of all elements of a matrix in sagemath

I have a matrix of order n say M. If I do sum(M) I would get the a vector in which all the entries would give me the sum of elements of each row of M.

How can I find the sum of all elements of M? Does there exist any command which can return the sum of all elements of a matrix?

Please help me out.

2020-04-09 17:28:10 +0200 received badge  Notable Question (source)
2020-01-12 14:15:53 +0200 commented answer Is there any way to find the eigenvalues of a matrix in terms of a variable?

what shall i do?

2020-01-12 14:14:51 +0200 commented answer Is there any way to find the eigenvalues of a matrix in terms of a variable?

From the output it looks that the first two eigenvalues are imaginary , but if you put any particular value of $n$ the eigenvalues are real and hence the result does not match

2020-01-10 11:36:02 +0200 asked a question Is there any way to find the eigenvalues of a matrix in terms of a variable?

I have the following matrix

M=

2n-1 & n-1 & n

1 & 2n-3 & 0

1& 0 & 1

Here $n$ is a variable

I want to find its eigenvalues.

Is there any way to find the eigenvalues of this matrix in terms of $n$ in sagemath.

I even cant input a matrix in terms of a variable.

Can someone please help me out?

2019-12-10 01:40:21 +0200 received badge  Popular Question (source)
2019-10-09 14:27:58 +0200 asked a question How to draw the following graph in sagemath?

How to draw the following graph in sagemath?

I am uploading the image here:

https://imgur.com/Q3sUXn8

I know how to draw a graph but I am finding it difficult to draw the graph in exactly the same way as shown in the picture.

Is it possible to do this?

I will be very grateful if someone could kindly help me out

2019-09-25 13:24:59 +0200 asked a question How to find the subgraph homeomorphic to $K_5$ or $K_{3,3}$?

Given a graph $ G$ it is easy to check whether the Graph is planar or not using the command "$G$.is_planar()"

However I am stuck on the following :

Given a non-planar graph $G$ is it possible to find a subgraph of $G$ which is homeomorphic to $K_5$ or $K_{3,3}$?

As per Kuratowski Theorem any Graph $G$ is planar if and only if $G$ has a subgraph homeomorphic to $K_5$ or $K_{3,3}$.

Is it possible to find the required subgraph using sagemath?

2019-08-28 13:40:55 +0200 asked a question Given a matrix $M$ how to form the following matrix $N$ from $M$.

Given a matrix $M$ how to form the following matrix $N$ from $M$.

Suppose $M=$\begin{bmatrix} 0 &3 \ 2 &0 \end{bmatrix}

Here $M$ is a $2\times 2$ matrix with 1st row $[0,3]$ and 2nd row $[2,0]$.

We need to form $N$ such that

$N=$ \begin{bmatrix} 3& 3\ 2&2\end{bmatrix}

Here $N$ is a $2\times 2$ matrix with 1st row $[3,3]$ and 2nd row $[2,2]$.

Thus $N$ is formed from $M$ by just adding all the off the diagonal elements of $M$ in a given row to the diagonal element

So the diagonal element of $N$ is the sum of all the remaining entries in a given row of $M$ whereas the rest of the elements of $N$ are the same as $M$.

So the elements of $N$ are obtained from $M$ in the following way :

$a_{11}=0+3=3, a_{12}=3,a_{21}=2,a_{22}=2+0=2$

How to code it?

Please help.

2019-08-27 10:35:53 +0200 commented answer How to draw a graph whose vertices are elements of permutation group

Thank you for your answer

2019-08-27 10:33:41 +0200 commented answer How to draw the following graph

I am extremely thankful for the answer. Can you kindly say how to start learning coding in sagemath? How to know the way to write loops , how to draw a graph, add edges as you have etc.??

2019-08-26 16:02:04 +0200 asked a question How to draw the following graph

I want to write the following code in sagemath but unable to write it:

Suppose we consider the group $\Bbb Z_n$.

We consider an element $a\in \Bbb Z_n$ and form the subgroup generated by $a$ i.e. $\langle a\rangle ={a,2a,3a,\ldots 0}.$

We form a graph $G$ whose vertices are $\langle a\rangle $ and $\langle a\rangle $ and $\langle b\rangle $ are adjacent if either $\langle a\rangle \subset \langle b\rangle $ or $\langle b\rangle \subset \langle a\rangle $ .

How to plot the graph $G$ is Sagemath?

I am giving an example to clear the question:

Consider $\Bbb Z_4$ then consider $\langle 0\rangle $, $ \langle 1\rangle$ , $ \langle 2\rangle$, $ \langle 3\rangle$

Clearly $\langle 0\rangle ={0}$, $ \langle 1\rangle={1,2,3,0}$ , $ \langle 2={2,0}\rangle$, $ \langle 3={0,1,2,3}\rangle$.

Thus the graph $G$ has vertices as $\langle 0\rangle $, $ \langle 1\rangle$ , $ \langle 2\rangle$, $ \langle 3\rangle$ and $\langle 0\rangle $ is adjacent to $ \langle 1\rangle$ , $ \langle 2\rangle$, $ \langle 3\rangle$,

$\langle 1\rangle $ is adjacent to $ \langle 2\rangle$ , $ \langle 0\rangle$,

$\langle 2\rangle $ is adjacent to $ \langle 1\rangle$ , $ \langle 0\rangle$, $ \langle 3\rangle$

and $\langle 3\rangle $ is adjacent to $ \langle 0\rangle$, $ \langle 2\rangle$

Thus $G$ becomes

https://imgur.com/Ef9P4uz

2019-08-06 03:59:06 +0200 commented answer How to draw a graph whose vertices are elements of permutation group

I am extremely thankful for the answer sir. Can you kindly explain the logic behind "if x in d: d[x].append(y) else d[x]=[y]" If you could explain why is it written this way I will be grateful

2019-08-06 03:53:33 +0200 marked best answer Code to find separating set in SageMath of a given Graph

Given a Graph $G$ how can I find the separating set of the Graph?

Suppose I am given this graph

G = Graph({1: [2, 3, 4, 5],
           2: [1, 3, 4, 5],
           3: [1, 2, 4, 5],
           4: [1, 2, 3],
           5: [1, 2, 3]})

I want to find the set of vertices whose removal disconnects the graph.

I found that the vertex connectivity of $G$ is 2.

Looking at the graph, the smallest set of vertices whose removal disconnects the graph is $(1, 2, 3)$.

But how to find it using a code in SageMath?

2019-08-06 03:53:26 +0200 received badge  Citizen Patrol (source)
2019-08-06 03:53:23 +0200 commented answer Code to find separating set in SageMath of a given Graph

Okay Thank you so much

2019-08-05 15:51:42 +0200 edited question How to draw a graph whose vertices are elements of permutation group

How to write the following program in SageMath:

Consider the Permutation Group $S_3$.

The elements of $S_3$ are $e,(12),(13),(23),(123),(132)$.

I want to draw a graph $G$ whose members are the elements of $S_3$ and two vertices $x,y$ are adjacent if and only if $xy\neq yx$.

I am stuck in doing the following things:

  1. How to call the elements of $S_3$ through a loop?
  2. How to draw the graph $G$ ?

I can check whether they commute or not but I am stuck in the two things. Is there any way to write the code in SageMath?

As an example if I input $S_3$ I want to get the following graph

$G=Graph({1:[2,3,4,5],2:[1,3,4,5],3:[1,2,4,5],4:[1,2,3],5:[1,2,3]})$

Any help will be highly appreciated.