+ Reply to Thread
Results 1 to 2 of 2

How many moves to be adjacent to all nodes on an ordered directed tree, with criteria

  1. #1
    Registered User
    Join Date
    06-10-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2019 for Mac
    Posts
    26

    How many moves to be adjacent to all nodes on an ordered directed tree, with criteria

    I suspect this is quite a complicated question but I hope that, once understood, it can be answered more simply.

    Consider an ordered directed tree (I think it's called that, according to Wikipedia); specifically consider the route one would follow to trace a path from the first root node through all internal nodes finally to the last terminal node (I've taken this terminology also straight from Wikipedia). I want to count how many steps are necessary and sufficient to cover all adjacent nodes on such a tree data structure, given that certain criteria are satisfied. Moreover, this count should be cumulative so that even if backtracking is involved, such steps should contribute to the total (also subject to satisfying certain criteria). Here are 7 columns of information pertaining to the tree structure under consideration (I suggest that you download the attachment and view it alongside my description below, as I think it makes things easier to understand Book1.xlsx):

    order # node class c. route crit1 crit2 crit3
    0 27 root 0 A 1
    1 28 internal 0
    2 29 branch 0 Z
    2.1.1 39 leaf 1 A 0
    2.1.2 40 leaf
    2.1.3 812 leaf
    2.1.4 813 terminal
    2.2 32 branch 1
    2.2.1 635 terminal 2 A 0
    2.2.2 33 branch 2 Z
    2.2.2.1 775 terminal 3 A 1
    2.2.2.2 34 branch 3 Z
    2.2.2.2.1 35 terminal Z
    2.2.2.2.2 36 terminal Z
    2.2.2.2.3 37 terminal Z
    2.2.2.2.1 35 terminal Z
    3 30 internal 1
    4 9 internal 4 Z
    5 11 branch 5
    5.1.1 828 leaf 6 Z
    5.1.2 829 terminal 7
    6 12 branch 6
    6.1.1 781 leaf 8 A 1
    6.1.2 784 leaf 9
    6.1.3 782 leaf 10
    6.1.4 783 leaf 11
    6.1.5 785 terminal 12
    7 13 internal 8
    8 14 internal 14
    9 15 internal 15
    10 16 branch 16
    10.1 601 terminal 17 A 0
    11 17 internal 17
    12 18 internal 18
    13 19 terminal 19

    order: this is the order that nodes follow from the root node through each branch to the final terminal node.
    #: this is a random number that uniquely identifies each node.
    node class: this indicates the sort of node and how it lies in relation to other nodes.
    c. route: this is what I'm trying to ascertain without doing it manually, by eye, as I've done so here.
    crit1-crit3: these are criteria that must be satisfied for any steps to count at all.

    So to reiterate the question, I want to calculate how many moves it takes to satisfy having been adjacent to each node at least once. The idea is that, based on a given position at a given node, moving to be adjacent to a new node contributes to the total number of steps. I've made node 28 bold to indicate that this is the "starting node." The current position adjacent to nodes 27 and 28 does not contribute to the cumulative count because we haven't moved yet. But once we move from node 28 to 29, the cumulative count becomes 1 and we are adjacent to nodes 39, 32 and 30. This process continues until we have been adjacent to all nodes, but how many steps is that?

    However, we do not need to have been adjacent to nodes that satisfy the following criteria:
    (1) if "crit1" = A and "crit2" = 0 and "node class" = leaf, or
    (2) if "crit3" = Z and "node class" = terminal,
    then those corresponding nodes (and their descendant nodes, in the case of the first criterion) should be ignored. This is why nodes 40, 812, 813 and nodes 35, 36, 37 are blank.

    A final criterion is that, backtracking (over nodes already covered) contributes to the cumulative total as well, specifically in multiples of 4 moves. So, for instance, when returning to node 12 after having moved 4 moves to node 783, this backtracking takes up 4 moves and contributes 1 to the cumulative count. 1-4 moves contributes 1 to the total, whereas if it had taken 5-8 moves this would have contributed 2 to the total (and 9-12 moves, 3 etc.). This means that moving from node 783 to node 13 will add 2 to the count (backtracking over 4 nodes + moving adjacent to a new node) and this is why I've put the cumulative count at node 14 as "14" instead of "13."

    I think that's all. I know this probably sounds like a huge mission, but once I got my head around the issue then what's required seemed simple (not that I've come up with anything). I'd be so very grateful (and very interested) to see a solution.

    P.S. I've found the notion of a parent ID to be useful, if that helps. A column of values that indicate the node level also seems to be pertinent.

    Here's the attachment again:
    Book1.xlsx
    Last edited by rinkjames; 06-18-2012 at 06:29 PM.

  2. #2
    Registered User
    Join Date
    06-10-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2019 for Mac
    Posts
    26

    Re: How many moves to be adjacent to all nodes on an ordered directed tree, with criteria

    Sorry to double post, but I think I made some progress. I've renamed the node classes and used them to number the nodes that don't deviate off the main path. What I'm trying to do now is filter the nodes that should be ignored and enter values into an adjacent column for additional moves that deviate from the main path. That way I could, I think, sum the columns cell for cell to generate a list of cumulative moves. I haven't been able to filter these nodes yet.

    Book1.xlsx
    Last edited by rinkjames; 06-18-2012 at 09:06 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1