Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalized Sierpinski graphs generator #33854

Closed
dcoudert opened this issue May 15, 2022 · 49 comments
Closed

Generalized Sierpinski graphs generator #33854

dcoudert opened this issue May 15, 2022 · 49 comments

Comments

@dcoudert
Copy link
Contributor

See https://ask.sagemath.org/question/62417/generalized-sierpinski-graph-construction/

CC: @sagetrac-tmonteil @fchapoton

Component: graph theory

Author: David Coudert

Branch/Commit: 11c69b7

Reviewer: Thierry Monteil, Frédéric Chapoton

Issue created by migration from https://trac.sagemath.org/ticket/33854

@dcoudert dcoudert added this to the sage-9.7 milestone May 15, 2022
@dcoudert
Copy link
Contributor Author

New commits:

4d4f224trac #33854: generalized Sierpinski graphs

@dcoudert
Copy link
Contributor Author

Branch: public/graphs/33854_sierpinski

@dcoudert
Copy link
Contributor Author

Commit: 4d4f224

@dcoudert
Copy link
Contributor Author

comment:2

To get the Sierpinski graph S(n, k), it suffices to call GeneralizedSierpinskiGraph with a clique of order n.

@prajnanaswaroopa
Copy link

comment:4

The source code as given on the GitHub page, gives the error object of type 'int' has no len().

@dcoudert
Copy link
Contributor Author

comment:5

Which parameters have you used ? It's impossible for me to guess from your message.

Have you read and followed the description of the method ?

@prajnanaswaroopa
Copy link

comment:6

I used the parameters H=graphs.CompleteGraph(4), kk=2. I tried to modify the code to make it somehow work by changing next(H.vertex_iterator()) to H.order() and the lineJ = H.relabel(perm={u: (i,) + u for u in H}, inplace=False) to J = H.relabel(perm={u: (i,u) for u in H}, inplace=False). But the graph output is not as expected. On only changing next(H.vertex_iterator to H.order(), the error is can only concatenate tuple, not 'int' to tuple.

@dcoudert
Copy link
Contributor Author

comment:7

Can you clarify what you expect ?

The code in this ticket strictly follows the definition given in the paper by Gravier, Kovse and Parreau, and we can get all the examples given in the papers about generalized Sierpinski graphs. For your parameters, we get:

sage: G = GeneralizedSierpinskiGraph(graphs.CompleteGraph(4), 2)
sage: print(G.vertices())
[(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3), (3, 0), (3, 1), (3, 2), (3, 3)]
sage: print(G.edges(labels=False))
[((0, 0), (0, 1)), ((0, 0), (0, 2)), ((0, 0), (0, 3)), ((0, 1), (0, 2)), ((0, 1), (0, 3)), ((0, 1), (1, 0)), ((0, 2), (0, 3)), ((0, 2), (2, 0)), ((0, 3), (3, 0)), ((1, 0), (1, 1)), ((1, 0), (1, 2)), ((1, 0), (1, 3)), ((1, 1), (1, 2)), ((1, 1), (1, 3)), ((1, 2), (1, 3)), ((1, 2), (2, 1)), ((1, 3), (3, 1)), ((2, 0), (2, 1)), ((2, 0), (2, 2)), ((2, 0), (2, 3)), ((2, 1), (2, 2)), ((2, 1), (2, 3)), ((2, 2), (2, 3)), ((2, 3), (3, 2)), ((3, 0), (3, 1)), ((3, 0), (3, 2)), ((3, 0), (3, 3)), ((3, 1), (3, 2)), ((3, 1), (3, 3)), ((3, 2), (3, 3))]

If you want another construction, please give its formal definition.

@prajnanaswaroopa
Copy link

comment:8

Where are you able to run the function? I mean, do you use the Sage compiler, or, you use some other kernel to run the command GeneralizedSierpinskiGraph(,). Or, did you write the full source code and then run the function?

@dcoudert
Copy link
Contributor Author

comment:9

I copy/paste the method in a sagemath console, but you can also use a Jupyter notebook running sagemath kernel.

@prajnanaswaroopa
Copy link

comment:10

Thanks! I copied the whole source code from Git Hub page, and it worked well. Hope this get pushed to Sage repository soon.

@dcoudert
Copy link
Contributor Author

comment:11

feel free to help reviewing this ticket.

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented May 31, 2022

comment:12

This is only a tiny contribution to the review, since i did not check the code. Here are some typos:

  • "Sierpiński" : the accent is over the n, not the s
  • "pervertex"

Also, the motivation for such a construction seems to be geometrical. So, if the vertices of a graph have planar positions, then so should its generalized Sierpiński image. For example, with the house graph of the poster:

graphs.HouseGraph().plot()

but

graphs.GeneralizedSierpinskiGraph(graphs.HouseGraph(),2).plot()

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented May 31, 2022

Reviewer: Thierry Monteil

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented May 31, 2022

comment:13

Also, if you add crosslinks to SierpinskiGasketGraph and HanoiTowerGraph, perhaps should there also be links to GeneralizedSierpinskiGraph from those constructions.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

70e0c21trac #33854: merged with 9.7.beta1
30623b4trac #33854: typo and crosslinks

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2022

Changed commit from 4d4f224 to 30623b4

@dcoudert
Copy link
Contributor Author

dcoudert commented Jun 1, 2022

comment:15
  • "Sierpiński" : the accent is over the n, not the s

I'm unable to locate the typo

I agree that it would be nice to provide the nice embedding, but I I don't know how to do that.

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Jun 1, 2022

comment:16

Replying to @dcoudert:

  • "Sierpiński" : the accent is over the n, not the s

I'm unable to locate the typo

Oh, it seems that the trac text editor and the gitweb moved the accent, see sagemath/sagetrac-mirror@5fb2a6e...30623b4 (8 occurrences).

I agree that it would be nice to provide the nice embedding, but I I don't know how to do that.

If you have a graph of depth 3, any vertex comes from 3 vertices (i,j,k), one for each depth. You can set the position of that vertex to pos(i) + K*pos(j) + K^2*pos(k) where K > 1 is some stretching factor, that could be set by the user or its default value could be computed as, say, twice the geometrical diameter of the graph.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 4, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

b9645b2trac #33854: set positions

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 4, 2022

Changed commit from 30623b4 to b9645b2

@dcoudert
Copy link
Contributor Author

dcoudert commented Jun 4, 2022

comment:18

I followed your idea. We can get some nice plots.

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Jun 20, 2022

comment:24

I was thinking of a better placement formula, since some pictures are not well rendered, but it will be for a future ticket.

@vbraun
Copy link
Member

vbraun commented Jun 27, 2022

comment:25

pdf docs don't build

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 28, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

60d010atrac #33854: Merged with 9.7.beta3
a830e0ctrac #33854: correct accent in index.rst

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 28, 2022

Changed commit from a6602f3 to a830e0c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 28, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

5540573trac #33854: correct another accent in index.rst

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 28, 2022

Changed commit from a830e0c to 5540573

@dcoudert
Copy link
Contributor Author

comment:28

Now the problem is the accent in Sierpiński in families.py. What's the trick to put it ? the alternative is to remove it.

@dcoudert
Copy link
Contributor Author

comment:29

@ Frédéric, do you know how to add utf8 symbols to the documentation of a method without breaking the pdf doc ?

@fchapoton
Copy link
Contributor

comment:30

one has to declare characters one by one

see

src/sage_docbuild/conf.py:    \DeclareUnicodeCharacter{0428}{cyrillic Sha}

@dcoudert
Copy link
Contributor Author

comment:31

I tried to add \DeclareUnicodeCharacter{0144}{Latin small letter n with acute}, but the pdf compilation still failed.

@fchapoton
Copy link
Contributor

comment:32

strange (and probably wrong) use of latex syntax for accents in the master reference file

@fchapoton
Copy link
Contributor

comment:33

The ï of Hanoï is certainly problematic too

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2022

Changed commit from 5540573 to fcac17c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

fcac17ctrac #33854: avoid unicode characters

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2022

Changed commit from fcac17c to 11c69b7

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

11c69b7trac #33854: remove unicode characters

@dcoudert
Copy link
Contributor Author

comment:36

I removed the unicode characters.

@fchapoton
Copy link
Contributor

comment:37

are we ok with the accents in

Sandi Klavžar and Uroš Milutinović

?

@dcoudert
Copy link
Contributor Author

dcoudert commented Jul 7, 2022

comment:38

I can build the both the html and the pdf docs with the current branch.

May be the issue with the special character in Sierpinski is that I don't have both the right unicode character and its code.

@fchapoton
Copy link
Contributor

comment:39

alors on peut ré-essayer.

@vbraun
Copy link
Member

vbraun commented Jul 9, 2022

Changed branch from public/graphs/33854_sierpinski to 11c69b7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants