Is there a built-in function I can use to measure the similarity of two trees?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
This is a higher level question, and I don't expect a full answer, but maybe a nudge in the right direction would help, or maybe there is a built in Mathematica function that does something very similar to this already.
I have a list A
of lists. The lists in A
are of different length, and can even have different levels. One example of these is, using TreeForm
:
Another example would be:
So there are obviously a lot of differences between them.
I have written a function which extracts the elements at each level, so that I can then compare the lists level by level. However, I wonder - is there a built in function in Mathematica that does something similar to this, and generates a number representing how far apart they are? I have looked, but not found anything yet that works on lists of different dimensions.
Or even, could there be a way to convert these to graphs, and then, maybe there would be a built in function that compares the similarity of graphs?
Any hints on the best way to find the similarity between any two of the lists in list A
would be very appreciated! Again, I don't expect any hand-outs, but a point in the right direction would be great!
list-manipulation distance nearest
add a comment |Â
up vote
3
down vote
favorite
This is a higher level question, and I don't expect a full answer, but maybe a nudge in the right direction would help, or maybe there is a built in Mathematica function that does something very similar to this already.
I have a list A
of lists. The lists in A
are of different length, and can even have different levels. One example of these is, using TreeForm
:
Another example would be:
So there are obviously a lot of differences between them.
I have written a function which extracts the elements at each level, so that I can then compare the lists level by level. However, I wonder - is there a built in function in Mathematica that does something similar to this, and generates a number representing how far apart they are? I have looked, but not found anything yet that works on lists of different dimensions.
Or even, could there be a way to convert these to graphs, and then, maybe there would be a built in function that compares the similarity of graphs?
Any hints on the best way to find the similarity between any two of the lists in list A
would be very appreciated! Again, I don't expect any hand-outs, but a point in the right direction would be great!
list-manipulation distance nearest
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
This is a higher level question, and I don't expect a full answer, but maybe a nudge in the right direction would help, or maybe there is a built in Mathematica function that does something very similar to this already.
I have a list A
of lists. The lists in A
are of different length, and can even have different levels. One example of these is, using TreeForm
:
Another example would be:
So there are obviously a lot of differences between them.
I have written a function which extracts the elements at each level, so that I can then compare the lists level by level. However, I wonder - is there a built in function in Mathematica that does something similar to this, and generates a number representing how far apart they are? I have looked, but not found anything yet that works on lists of different dimensions.
Or even, could there be a way to convert these to graphs, and then, maybe there would be a built in function that compares the similarity of graphs?
Any hints on the best way to find the similarity between any two of the lists in list A
would be very appreciated! Again, I don't expect any hand-outs, but a point in the right direction would be great!
list-manipulation distance nearest
This is a higher level question, and I don't expect a full answer, but maybe a nudge in the right direction would help, or maybe there is a built in Mathematica function that does something very similar to this already.
I have a list A
of lists. The lists in A
are of different length, and can even have different levels. One example of these is, using TreeForm
:
Another example would be:
So there are obviously a lot of differences between them.
I have written a function which extracts the elements at each level, so that I can then compare the lists level by level. However, I wonder - is there a built in function in Mathematica that does something similar to this, and generates a number representing how far apart they are? I have looked, but not found anything yet that works on lists of different dimensions.
Or even, could there be a way to convert these to graphs, and then, maybe there would be a built in function that compares the similarity of graphs?
Any hints on the best way to find the similarity between any two of the lists in list A
would be very appreciated! Again, I don't expect any hand-outs, but a point in the right direction would be great!
list-manipulation distance nearest
list-manipulation distance nearest
edited 17 mins ago
m_goldberg
82.1k869190
82.1k869190
asked 4 hours ago
Jmeeks29ig
48428
48428
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
One approach is with Level. If your expression is called struct,
Level[struct, 0, Infinity]
or perhaps
Level[struct, 0, Infinity, Heads -> True]
or even
Level[struct, #] & /@ Range[Depth[struct]]
You can also pick individual levels at will. As for measuring how far apart the levels are, you could do something as simple as length, or some function of length and depth. Crudely, this might be similar to
LeafCount[struct]
Great, thanks, I will give that a go!
â Jmeeks29ig
1 hour ago
add a comment |Â
up vote
1
down vote
There's no unique measure, so I would use GraphPropertyDistribution
on as many graph properties as you can imagine.
Alright, thanks, I'll look into that!
â Jmeeks29ig
1 hour ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
One approach is with Level. If your expression is called struct,
Level[struct, 0, Infinity]
or perhaps
Level[struct, 0, Infinity, Heads -> True]
or even
Level[struct, #] & /@ Range[Depth[struct]]
You can also pick individual levels at will. As for measuring how far apart the levels are, you could do something as simple as length, or some function of length and depth. Crudely, this might be similar to
LeafCount[struct]
Great, thanks, I will give that a go!
â Jmeeks29ig
1 hour ago
add a comment |Â
up vote
3
down vote
accepted
One approach is with Level. If your expression is called struct,
Level[struct, 0, Infinity]
or perhaps
Level[struct, 0, Infinity, Heads -> True]
or even
Level[struct, #] & /@ Range[Depth[struct]]
You can also pick individual levels at will. As for measuring how far apart the levels are, you could do something as simple as length, or some function of length and depth. Crudely, this might be similar to
LeafCount[struct]
Great, thanks, I will give that a go!
â Jmeeks29ig
1 hour ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
One approach is with Level. If your expression is called struct,
Level[struct, 0, Infinity]
or perhaps
Level[struct, 0, Infinity, Heads -> True]
or even
Level[struct, #] & /@ Range[Depth[struct]]
You can also pick individual levels at will. As for measuring how far apart the levels are, you could do something as simple as length, or some function of length and depth. Crudely, this might be similar to
LeafCount[struct]
One approach is with Level. If your expression is called struct,
Level[struct, 0, Infinity]
or perhaps
Level[struct, 0, Infinity, Heads -> True]
or even
Level[struct, #] & /@ Range[Depth[struct]]
You can also pick individual levels at will. As for measuring how far apart the levels are, you could do something as simple as length, or some function of length and depth. Crudely, this might be similar to
LeafCount[struct]
edited 2 hours ago
answered 4 hours ago
bill s
51.1k373145
51.1k373145
Great, thanks, I will give that a go!
â Jmeeks29ig
1 hour ago
add a comment |Â
Great, thanks, I will give that a go!
â Jmeeks29ig
1 hour ago
Great, thanks, I will give that a go!
â Jmeeks29ig
1 hour ago
Great, thanks, I will give that a go!
â Jmeeks29ig
1 hour ago
add a comment |Â
up vote
1
down vote
There's no unique measure, so I would use GraphPropertyDistribution
on as many graph properties as you can imagine.
Alright, thanks, I'll look into that!
â Jmeeks29ig
1 hour ago
add a comment |Â
up vote
1
down vote
There's no unique measure, so I would use GraphPropertyDistribution
on as many graph properties as you can imagine.
Alright, thanks, I'll look into that!
â Jmeeks29ig
1 hour ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
There's no unique measure, so I would use GraphPropertyDistribution
on as many graph properties as you can imagine.
There's no unique measure, so I would use GraphPropertyDistribution
on as many graph properties as you can imagine.
answered 2 hours ago
David G. Stork
21.5k11646
21.5k11646
Alright, thanks, I'll look into that!
â Jmeeks29ig
1 hour ago
add a comment |Â
Alright, thanks, I'll look into that!
â Jmeeks29ig
1 hour ago
Alright, thanks, I'll look into that!
â Jmeeks29ig
1 hour ago
Alright, thanks, I'll look into that!
â Jmeeks29ig
1 hour ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182274%2fis-there-a-built-in-function-i-can-use-to-measure-the-similarity-of-two-trees%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password