Hello everybody !

I come back again with a problem that was forgotten but never solved.
It is FindStat related.

1) here are two functions in Sage named Poset.to_graph and
Graph.to_partition. Those two functions have a common point: their
name is rather vague.

Poset.to_graph)
   There are three graphs that I know which can be associated to a
Poset. Its comparability graph [1], its incomparability graph, and the
undirected version of its Hasse Diagram [2]. When I see
"Poset.to_graph" I cannot guess which one it may be. Turns out that
P.to_graph is actually Graph(P.hasse_diagram()) or
P.hasse_diagram().to_undirected() which is rather explicit.

Graph.to_partition)
   There are 1000 different partitions that can be associated to a
Graph. In fact, I could describe the work of most researchers I know
as "an attempt to compute a partition of a graph". In this specific
situation, the function Graph.to_partition returns the partition
associated to the sizes of the connected components of the graph. You
can obtain it with
Partition(sorted(map(len,G.connected_components()),reverse=True)). I
cannot emphasize sufficiently that no researcher in graph theory will
never associate "partition" to "partition of an integer". When we talk
about a partition, we talk about a partition of the vertex set.

2) What about those functions ?

Both could be renamed to have more meaningful names. This being said,
I would not see the point of a Poset.hasse_diagram_undirected() or
Poset.undirected_hasse_diagram() when it can already be obtained as
Graph(Poset.hasse_diagram()).

Graph.to_partition could be renamed to
Graph.connected_components_sizes_partition. Indeed, we already have:
- Graph.connected_component_containing_vertex
- Graph.connected_components
- Graph.connected_components_number
- Graph.connected_components_subgraphs

and so this function could join them. I would personally prefer to
have this function removed too: to me this function should be
implemented in FindStat [3] and is not useful to us.

Nathann

[1] http://www.sagemath.org/doc/reference/graphs/sage/graphs/comparability.html
[2] the "undirected version of the transitive closure of its hasse
diagram" is equal to the comparability graph.
[3] http://www.findstat.org/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to