GraphTheory
Newick
compute Newick encoding
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Newick(G, opts)
Newick(s)
G
-
graph; tree or arborescence
s
string
opts
(optional) one or more options as specified below
directed = truefalse
Specifies whether the output graph should be directed or undirected when the input is a Newick string. The default is true. When the input is not a string, this option is ignored.
root = string, name, or integer
Specifies a root vertex when the input is an undirected graph. The default value is the first vertex in the list returned by Vertices. When the input is not an undirected graph, this option is ignored.
Newick(G), where G is a graph, returns a string comprising the Newick encoding of G.
If G is undirected, it must be a tree.
If G is directed, it must be an arborescence or anti-arborescence.
Newick(s), where s a string, returns a graph whose Newick encoding is s.
Generate the Newick encoding of a tree.
with⁡GraphTheory:
T≔Graph⁡10,1,8,2,3,2,7,4,6,5,6,6,7,6,8,7,9,8,10
T≔Graph 1: an undirected graph with 10 vertices and 9 edge(s)
Newick⁡T
(((4,5,((3)2,9)7)6,10)8)1;
Generate the Newick encoding of an arborescence.
A≔Graph⁡10,2,5,3,4,3,7,4,1,5,3,5,6,9,8,10,2,10,9
A≔Graph 2: a directed graph with 10 vertices and 9 arc(s)
Newick⁡A
(((((1)4,7)3,6)5)2,(8)9)10;
Generate the unweighted graph corresponding to a given Newick encoding.
Newick⁡(((((6,(((9)16)4)15)8,(11,(19)20)10)2,(17)12,13)3,(7)5)14,18)1;
Graph 3: a directed graph with 20 vertices and 19 arc(s)
Generate the weighted graph corresponding to a given Newick encoding.
Newick⁡(((((((4:2.990)10:6.574)9:5.323)6:2.994,(5:1.025)8:6.644)7:2.876)3:8.254)2:6.146)1;
Graph 4: a directed weighted graph with 10 vertices and 9 arc(s)
The GraphTheory[Newick] command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
IsArborescence
IsTree
PrueferCode
Download Help Document