sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 481 forks source link

Connect combinatorics trees to graph trees #29270

Open kcrisman opened 4 years ago

kcrisman commented 4 years ago

As far as I can tell, there is not much connection between the various sage-combinant trees and the "graph theory" ones. E.g. I couldn't figure out how to get

sage: G = graphs.BalancedTree(2,5)
sage: G.show(vertex_labels=False, vertex_size=0, layout='tree', tree_root=0)

from the combinatorial ones.

This might just be missing documentation, or an enhancement request to connect them more.

CC: @hivert @fchapoton

Component: graph theory

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

mantepse commented 4 years ago
comment:1

Are you looking for the following?

sage: T = BinaryTrees(15).random_element()
sage: T.to_undirected_graph().show(vertex_labels=False, vertex_size=0, layout='tree', tree_root=0)
Launched png viewer for Graphics object consisting of 15 graphics primitives
kcrisman commented 4 years ago
comment:2

Yes, something like that. But for some reason not every tree from the combinat had this in the tab-completion.

sage: R = RootedTree([[], [[]]])
sage: R.to_undirected_graph()
---------------------------------------------------------------------------
...
AttributeError: 'RootedTrees_all_with_category.element_class' object has no attribute 'to_undirected_graph'

Since I was looking for a rooted tree, this seemed like something to try ...

Anyway, I'm not necessarily suggesting this is an actual code thing, maybe documentation. Then again, I don't see why a tree couldn't be a tree.

dcoudert commented 4 years ago
comment:3

We could have a true tree backend in graphs with implementation of dedicated algorithms and connected to trees in combinat. We already have BipartiteGraph...

mkoeppe commented 4 years ago
comment:4

Batch modifying tickets that will likely not be ready for 9.1, based on a review of the ticket title, branch/review status, and last modification date.

mkoeppe commented 3 years ago
comment:6

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.