Trees | Indices | Help |
|
---|
|
Contains all sort of utilities to search and manipulate nested lists as trees.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Author: by Mehdi Khoury
Version: 1.20
Copyright: (c) 2009 Mehdi Khoury under the mit license http://www.opensource.org/licenses/mit-license.html
|
|||
TreeUtilError | |||
NestedHeadNode | |||
NotAList | |||
EmptyList | |||
EmptyDict | |||
CalculationError | |||
WrongValues |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
__package__ = None
|
|
Function: listGetRootNodeget the root node of a nested list
|
Function: BFS_SearchTraverse the nodes of a tree in breadth-first order.
|
Function: walkWalk over a sequence of items, printing each one in turn, and recursively walking over sub-sequences.
|
Function: getChildrenNodes2Get the children nodes in a nested list for a specific depth
|
Function: PostOrder_SearchTraverse the nodes of a tree by getting the leafs first and the branches after. Finishes with the root. e.g. [1,[2,[3,4,[5,6,7]]],[8,[9,10,11]],[12,13,14]] gives : [7, 6, 5, 4, 3, 2, 11, 10, 9, 8, 14, 13, 12, 1]
|
Function: DFS_Searcha recursive generator that flatten a nested list gives a list of all nodes in the tree in Depth First Search order
|
Function: BranchNodes_Searcha generator to iterate through branch nodes only in BFS order.
|
Function: LeafNodes_Searcha generator to iterate through leaf nodes only in right-to-left BFS preorder.
|
Function: isNestedCheck if a list is nested
|
Function: list_getTailget the tail of a 'node' e.g. [1,2]->[2] e.g. [1,[2,4],5]->[2,5]
|
Function: getSubListsget a list of all sub lists in a nested list
|
Function: nestedListToDictget a dictionnary from a nested list
|
Function: dictFindRootNodefind the root node of a tree in a dictionary (assumption is that a root node is a key never found in any of all values)
|
Function: dictGetRootListget the list coresponding to the root node
|
Function: dictToSubListsget a list version of the dictionary
|
Function: nestedInsertnest a list inside another one if the first one has elements which are head of lists or sub lists in list 2
|
Function: dictToNestedListfinally, transform the dictionary into a nested list
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 15 11:50:09 2009 | http://epydoc.sourceforge.net |