OK, I nearly forgot about the following: 

sage: K2=graphs.CompleteGraph(2)
sage: P=K2.cartesian_product(K2)
sage: print(P.graph6_string())
sage: print(P.sparse6_string())

Cr
:CoKN


However, my installation of nauty (and older installation of sage) claims, 
that to graph6_string "Cr" corresponds sparse6_string ":Cci". 
My running explanation is that graph6 and sparse6 use different ordering of 
the vertices, which is ... unfortunate. 

Not sure, if this is related, but I noticed that P.relabel() creates a 
mapping of original vertices to range(n) that looks random (I would expect 
the order to be according to the list P.vertices()). It would be nice to 
know, if this is expected behavious (and if the order may change in between 
different versions of Sage). Sorry for tugging a different question to one 
post; I thought it might be related. 


On Tuesday, November 5, 2019 at 1:43:23 AM UTC-8, Robert Samal wrote:
>
> I noticed the following strange behavior of 
> graph6_string()/sparse6_string() functions of graphs: 
>
> sage: K2=graphs.CompleteGraph(2)
> sage: P=K2.cartesian_product(K2)
>
> sage: print(P.sparse6_string())
> sage: print(Graph(P.graph6_string()).sparse6_string())
>
> :CoKN
> :Cci
>
>
> To explain: I understand, that Graph(P.graph6_string()) != P (as 
> graph6_string does not preserve the original set of vertices). 
> On the other hand, I was expecting that the ordering of vertices would be 
> the same, leading to the same sparse6_string(). 
>
> I understand that the problem stems from having vertices not of form 
> range(n). 
> However, even after looking at the documentation, I haven't been able to 
> decide, if this is a bug or feature ... 
> If the latter is the case, I suggest adding a visible warning (or perhaps 
> only give the string if the list of vertices is range(n)?). 
>
> Another observation, in the other direction I see the same behaviour: 
>
> sage: print(P.graph6_string())
> sage: print(Graph(P.sparse6_string(),loops=False, multiedges=False).
> graph6_string())
>
> Cr
> C]
>
>
> I am using sage 8.9 (python 3 and python 2 versions behave the same). 
> On the other hand, an older version of sage behaves in the expected way, 
> that is returns the same string twice. 
> Also adding P.relabel() before the tests leads to the expected result. 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/b8150774-8dfe-497a-93db-7023128775c8%40googlegroups.com.

Reply via email to