I'm working with the NautyGraphs package in Macaulay2, and I use it to generate all triangle-free connected graphs with a fixed number of vertices, which gives me all undirected trees.
-- For example:
g = generateGraphs(10, OnlyTriangleFree => true, OnlyConnected => true);
stringToGraph g_5
gives me something like:
What I'd like to do is:
Transform each undirected tree in the list g into a directed rooted tree, where I choose vertex 0 as the root.
Remove rooted trees that are isomorphic as directed trees (i.e., same structure up to relabeling).
For example, I want to treat these two as equivalent and keep only one:
0 => {1,2}, 1 => {3}, 2 => {}, 3 => {}
0 => {1,2}, 1 => {}, 2 => {3}, 3 => {}
So my questions are:
Is there a recommended way in Macaulay2 (or external tools) to convert these undirected trees to rooted directed trees, choosing a fixed root like 0?
Is there a known method (in Macaulay2 or externally) to test isomorphism of rooted directed trees so that I can remove duplicates? Nauty allows to use "removeIsomorphs", so I could use it before trasforming in directed rooted trees, or it has a kind of controindication?
Any suggestions or references would be appreciated!