*****************************************************************************
*       www.FindStat.org - The Combinatorial Statistic Finder               *
*                                                                           *
*       Copyright (C) 2019 The FindStatCrew <info@findstat.org>             *
*                                                                           *
*    This information is distributed in the hope that it will be useful,    *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   *
*****************************************************************************

-----------------------------------------------------------------------------
Statistic identifier: St000168

-----------------------------------------------------------------------------
Collection: Ordered trees

-----------------------------------------------------------------------------
Description: The number of internal nodes of an ordered tree.

A node is internal if it is neither the root nor a leaf.

-----------------------------------------------------------------------------
References: 

-----------------------------------------------------------------------------
Code:
def statistic(t):
    stack = [c for c in t]
    ni = 0
    while len(stack)!=0:
        tree = stack.pop()
        if len(tree)!=0:
            ni+=1
            stack.extend(tree)
    return ni

-----------------------------------------------------------------------------
Statistic values:

[[]]                => 0
[[],[]]             => 0
[[[]]]              => 1
[[],[],[]]          => 0
[[],[[]]]           => 1
[[[]],[]]           => 1
[[[],[]]]           => 1
[[[[]]]]            => 2
[[],[],[],[]]       => 0
[[],[],[[]]]        => 1
[[],[[]],[]]        => 1
[[],[[],[]]]        => 1
[[],[[[]]]]         => 2
[[[]],[],[]]        => 1
[[[]],[[]]]         => 2
[[[],[]],[]]        => 1
[[[[]]],[]]         => 2
[[[],[],[]]]        => 1
[[[],[[]]]]         => 2
[[[[]],[]]]         => 2
[[[[],[]]]]         => 2
[[[[[]]]]]          => 3
[[],[],[],[],[]]    => 0
[[],[],[],[[]]]     => 1
[[],[],[[]],[]]     => 1
[[],[],[[],[]]]     => 1
[[],[],[[[]]]]      => 2
[[],[[]],[],[]]     => 1
[[],[[]],[[]]]      => 2
[[],[[],[]],[]]     => 1
[[],[[[]]],[]]      => 2
[[],[[],[],[]]]     => 1
[[],[[],[[]]]]      => 2
[[],[[[]],[]]]      => 2
[[],[[[],[]]]]      => 2
[[],[[[[]]]]]       => 3
[[[]],[],[],[]]     => 1
[[[]],[],[[]]]      => 2
[[[]],[[]],[]]      => 2
[[[]],[[],[]]]      => 2
[[[]],[[[]]]]       => 3
[[[],[]],[],[]]     => 1
[[[[]]],[],[]]      => 2
[[[],[]],[[]]]      => 2
[[[[]]],[[]]]       => 3
[[[],[],[]],[]]     => 1
[[[],[[]]],[]]      => 2
[[[[]],[]],[]]      => 2
[[[[],[]]],[]]      => 2
[[[[[]]]],[]]       => 3
[[[],[],[],[]]]     => 1
[[[],[],[[]]]]      => 2
[[[],[[]],[]]]      => 2
[[[],[[],[]]]]      => 2
[[[],[[[]]]]]       => 3
[[[[]],[],[]]]      => 2
[[[[]],[[]]]]       => 3
[[[[],[]],[]]]      => 2
[[[[[]]],[]]]       => 3
[[[[],[],[]]]]      => 2
[[[[],[[]]]]]       => 3
[[[[[]],[]]]]       => 3
[[[[[],[]]]]]       => 3
[[[[[[]]]]]]        => 4
[[],[],[],[],[],[]] => 0
[[],[],[],[],[[]]]  => 1
[[],[],[],[[]],[]]  => 1
[[],[],[],[[],[]]]  => 1
[[],[],[],[[[]]]]   => 2
[[],[],[[]],[],[]]  => 1
[[],[],[[]],[[]]]   => 2
[[],[],[[],[]],[]]  => 1
[[],[],[[[]]],[]]   => 2
[[],[],[[],[],[]]]  => 1
[[],[],[[],[[]]]]   => 2
[[],[],[[[]],[]]]   => 2
[[],[],[[[],[]]]]   => 2
[[],[],[[[[]]]]]    => 3
[[],[[]],[],[],[]]  => 1
[[],[[]],[],[[]]]   => 2
[[],[[]],[[]],[]]   => 2
[[],[[]],[[],[]]]   => 2
[[],[[]],[[[]]]]    => 3
[[],[[],[]],[],[]]  => 1
[[],[[[]]],[],[]]   => 2
[[],[[],[]],[[]]]   => 2
[[],[[[]]],[[]]]    => 3
[[],[[],[],[]],[]]  => 1
[[],[[],[[]]],[]]   => 2
[[],[[[]],[]],[]]   => 2
[[],[[[],[]]],[]]   => 2
[[],[[[[]]]],[]]    => 3
[[],[[],[],[],[]]]  => 1
[[],[[],[],[[]]]]   => 2
[[],[[],[[]],[]]]   => 2
[[],[[],[[],[]]]]   => 2
[[],[[],[[[]]]]]    => 3
[[],[[[]],[],[]]]   => 2
[[],[[[]],[[]]]]    => 3
[[],[[[],[]],[]]]   => 2
[[],[[[[]]],[]]]    => 3
[[],[[[],[],[]]]]   => 2
[[],[[[],[[]]]]]    => 3
[[],[[[[]],[]]]]    => 3
[[],[[[[],[]]]]]    => 3
[[],[[[[[]]]]]]     => 4
[[[]],[],[],[],[]]  => 1
[[[]],[],[],[[]]]   => 2
[[[]],[],[[]],[]]   => 2
[[[]],[],[[],[]]]   => 2
[[[]],[],[[[]]]]    => 3
[[[]],[[]],[],[]]   => 2
[[[]],[[]],[[]]]    => 3
[[[]],[[],[]],[]]   => 2
[[[]],[[[]]],[]]    => 3
[[[]],[[],[],[]]]   => 2
[[[]],[[],[[]]]]    => 3
[[[]],[[[]],[]]]    => 3
[[[]],[[[],[]]]]    => 3
[[[]],[[[[]]]]]     => 4
[[[],[]],[],[],[]]  => 1
[[[[]]],[],[],[]]   => 2
[[[],[]],[],[[]]]   => 2
[[[[]]],[],[[]]]    => 3
[[[],[]],[[]],[]]   => 2
[[[[]]],[[]],[]]    => 3
[[[],[]],[[],[]]]   => 2
[[[],[]],[[[]]]]    => 3
[[[[]]],[[],[]]]    => 3
[[[[]]],[[[]]]]     => 4
[[[],[],[]],[],[]]  => 1
[[[],[[]]],[],[]]   => 2
[[[[]],[]],[],[]]   => 2
[[[[],[]]],[],[]]   => 2
[[[[[]]]],[],[]]    => 3
[[[],[],[]],[[]]]   => 2
[[[],[[]]],[[]]]    => 3
[[[[]],[]],[[]]]    => 3
[[[[],[]]],[[]]]    => 3
[[[[[]]]],[[]]]     => 4
[[[],[],[],[]],[]]  => 1
[[[],[],[[]]],[]]   => 2
[[[],[[]],[]],[]]   => 2
[[[],[[],[]]],[]]   => 2
[[[],[[[]]]],[]]    => 3
[[[[]],[],[]],[]]   => 2
[[[[]],[[]]],[]]    => 3
[[[[],[]],[]],[]]   => 2
[[[[[]]],[]],[]]    => 3
[[[[],[],[]]],[]]   => 2
[[[[],[[]]]],[]]    => 3
[[[[[]],[]]],[]]    => 3
[[[[[],[]]]],[]]    => 3
[[[[[[]]]]],[]]     => 4
[[[],[],[],[],[]]]  => 1
[[[],[],[],[[]]]]   => 2
[[[],[],[[]],[]]]   => 2
[[[],[],[[],[]]]]   => 2
[[[],[],[[[]]]]]    => 3
[[[],[[]],[],[]]]   => 2
[[[],[[]],[[]]]]    => 3
[[[],[[],[]],[]]]   => 2
[[[],[[[]]],[]]]    => 3
[[[],[[],[],[]]]]   => 2
[[[],[[],[[]]]]]    => 3
[[[],[[[]],[]]]]    => 3
[[[],[[[],[]]]]]    => 3
[[[],[[[[]]]]]]     => 4
[[[[]],[],[],[]]]   => 2
[[[[]],[],[[]]]]    => 3
[[[[]],[[]],[]]]    => 3
[[[[]],[[],[]]]]    => 3
[[[[]],[[[]]]]]     => 4
[[[[],[]],[],[]]]   => 2
[[[[[]]],[],[]]]    => 3
[[[[],[]],[[]]]]    => 3
[[[[[]]],[[]]]]     => 4
[[[[],[],[]],[]]]   => 2
[[[[],[[]]],[]]]    => 3
[[[[[]],[]],[]]]    => 3
[[[[[],[]]],[]]]    => 3
[[[[[[]]]],[]]]     => 4
[[[[],[],[],[]]]]   => 2
[[[[],[],[[]]]]]    => 3
[[[[],[[]],[]]]]    => 3
[[[[],[[],[]]]]]    => 3
[[[[],[[[]]]]]]     => 4
[[[[[]],[],[]]]]    => 3
[[[[[]],[[]]]]]     => 4
[[[[[],[]],[]]]]    => 3
[[[[[[]]],[]]]]     => 4
[[[[[],[],[]]]]]    => 3
[[[[[],[[]]]]]]     => 4
[[[[[[]],[]]]]]     => 4
[[[[[[],[]]]]]]     => 4
[[[[[[[]]]]]]]      => 5

-----------------------------------------------------------------------------
Created: Nov 09, 2013 at 01:04 by Viviane Pons

-----------------------------------------------------------------------------
Last Updated: Apr 01, 2015 at 21:27 by Martin Rubey