subtree

Partial subtree-matching algorithm

岁酱吖の 提交于 2019-12-03 21:22:44
I searched the forums but I couldn't figure it out if the other similar questions are necessarily related to this one. What I'm trying to do is match a subtree to a tree of objects. I know there are pattern matching algorithms based on suffix trees or automata, but I'm not sure whether they apply here. I am trying to match the subtree given by the red nodes in the picture against the bigger tree, regardless of the overall structure of the tree or whether the red nodes have children or not. The reason straightforward pattern matching does not work is that no ordering of the nodes (post/preorder

git subtree push changes back to subtree project

最后都变了- 提交于 2019-12-02 20:49:13
The short of what's below: I want to push commit messages to a subtree, but only the messages that apply to that tree. How do I do this? I have two projects, Master and Slave . Slave is checked out as a subtree of Master checked out to lib/slave via git subtree merge --prefix=lib/slave --squash projects/slave where projects/slave is a branch that Slave is checked out into: Branches: master projects/slave → slave Now I'm working on my master branch, making commits to files that are part of both projects, everything is going smoothly. Now I want to push changes back to Slave : git checkout slave

Finding the most frequent subtrees in a collection of (parse) trees

前提是你 提交于 2019-12-01 12:12:02
I have a collection of trees whose nodes are labelled (but not uniquely). Specifically the trees are from a collection of parsed sentences (see http://en.wikipedia.org/wiki/Treebank ). I wish to extract the most common subtrees from the collection - performance is not (yet) an issue. I'd be grateful for algorithms (ideally Java) or pointers to tools which do this for treebanks. Note that order of child nodes is important. EDIT @mjv. We are working in a limited domain (chemistry) which has a stylised language so the varirty of the trees is not huge - probably similar to children's readers.

Finding the most frequent subtrees in a collection of (parse) trees

こ雲淡風輕ζ 提交于 2019-12-01 11:38:59
问题 I have a collection of trees whose nodes are labelled (but not uniquely). Specifically the trees are from a collection of parsed sentences (see http://en.wikipedia.org/wiki/Treebank). I wish to extract the most common subtrees from the collection - performance is not (yet) an issue. I'd be grateful for algorithms (ideally Java) or pointers to tools which do this for treebanks. Note that order of child nodes is important. EDIT @mjv. We are working in a limited domain (chemistry) which has a

git subtree pull says that the working tree has modifications, but git status says it doesn't. What gives?

痴心易碎 提交于 2019-11-30 16:58:19
If I do this in one of my repositories: git subtree pull --prefix=frameworks/AquaticPrime --squash AquaticPrime I get this: Working tree has modifications. Cannot add. If I do this (in the same place, of course): git status I get this: # On branch master nothing to commit (working directory clean) I'm not quite sure what's going on here. The git status command implies that I don't have modifications, so I'm assuming that the git subtree pull is referring to modifications in a different branch related to the subtree, but it's not entirely clear. Can anyone provide enlightenment? I just had the

How to maximize the weight of a tree by removing subtrees [closed]

只谈情不闲聊 提交于 2019-11-29 09:02:09
There is a rooted tree with N nodes (numbered 1 through N); node '1' is the root. Each node has a value; let's denote the value of node i by A(i). The following operation(s) can be performed any number of times (including zero): 1.choose any node which still exists in the tree and remove the whole sub- tree of this node including itself. 2.Let's define the profit as the sum of values of all nodes which currently exist in the tree minus X⋅k, where k denotes the number of times this operation was performed. Find the maximum possible profit. How can we calculate 'k' value here?(means no. of time

Can XPath do a foreign key lookup across two subtrees of an XML?

梦想的初衷 提交于 2019-11-29 08:01:06
Say I have the following XML... <root> <base> <tent key="1" color="red"/> <tent key="2" color="yellow"/> <tent key="3" color="blue"/> </base> <bucket> <tent key="1"/> <tent key="3"/> </bucket> </root> ...what would the XPath be that returns that the "bucket" contains "red" and "blue"? If you're using XSLT, I'd recommend setting up a key: <xsl:key name="tents" match="base/tent" use="@key" /> You can then get the <tent> within <base> with a particular key using key('tents', $id) Then you can do key('tents', /root/bucket/tent/@key)/@color or, if $bucket is a particular <bucket> element, key(

Boost 1.46.1, Property Tree: How to iterate through ptree receiving sub ptrees?

此生再无相见时 提交于 2019-11-28 22:15:41
问题 First of all I shall say that I think I got how it should be done but my code will not compile any way I try. I based my assumption on this official example of empty ptree trick. There you can find next line: const ptree &settings = pt.get_child("settings", empty_ptree<ptree>()); Which shows that it is (or should be) possible to get subptree out from ptree. So I assumed we could iterate thru ptree with something like BOOST_FOREACH in such manner: BOOST_FOREACH(const boost::property_tree:

Using Git how to merge a subtree from remote branch

旧时模样 提交于 2019-11-28 13:07:47
Subtrees in Git work nicely although some git commands remain to be supported for subtrees. Here's the question: How to make the subtree pull from a different remote branch like "stable" or "integrate"? FYI, we have a subtree "push" working as a script. In fact, it can even push the subtree to the specific branch of our choice on the remote repository. Does anybody know how to do the reverse on a pull or even have a clue? The simple pull works like this: git pull -s subtree remotebranch One idea that can be tried: Maybe a 2-step process will do the trick. The remote branch gets pulled from

How to maximize the weight of a tree by removing subtrees [closed]

三世轮回 提交于 2019-11-28 02:23:12
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 months ago . There is a rooted tree with N nodes (numbered 1 through N); node '1' is the root. Each node has a value; let's denote the value of node i by A(i). The following operation(s) can be performed any number of times (including zero): 1.choose any node which still exists in the tree