Skip to content

Conversation

@fqueyroi
Copy link

@fqueyroi fqueyroi commented May 21, 2021

Hi all!

After doing some tests, I seems to me that there is a cleaner way of defining the HON network (or rather the Edge set) from a set of Rules.
Let S=s1s2s3... be a rule and t a symbol in the input sequence such that Rules[S][t] > 0,
this will correspond in HON to a directed edge S -> S't where S't is the concatenation of S' and t
here S'=s3s4... is the longest suffix of S such that S't is an existing rule.

For example if S=abc and Rules[abc][t] > 0 then there will be an edge abc -> bct if 'abct' was not detected as a rule while 'bct' was.
If no extension of 't' was detected as a rule, we would simply have abc -> t (since the longest suffix S' is here the empty string).

From this definition we can rewrite the code of "BuildNetwork.py" without using any rewiring of edges. Using real datasets I got the same HON with the proposed changes. Moreover my method seems to be faster when there are a lot of edges to add (or rewiring to do in the current version).

I hope I didn't miss something. I tested both approaches on different real world sequences and the new definition of the edge set is comprehensive IMO but still ...

Hi all!

After doing some tests, I seems to me that there is a cleaner way of defining the HON network (or rather the Edge set) from a set of Rules.
Let S=s1s2s3... be a rule and t a symbol in the input sequence such that Rules[S][t] > 0,
this will correspond in HON to a directed edge S -> S*t where S*t is the concatenation of list S* and list with a single element t
here S*=s3s4... is the longest suffix of S such that S*t is an existing rule.

For example if S=abc and Rules[abc][t] > 0 then there will be an edge abc -> bct if 'abct' was not detected as a rule while 'bct' was. 
If not extension of 't' was detected as rule, we would simply have abc -> t (since the longest suffix S* is here the empty string). 

From this definition we can rewrite the code of "BuildNetwork.py" without using any rewiring of edges. Using real datasets I got the same HON with the proposed changes. Moreover my methods seems to be way faster when there are a lot of edges to add (or rewire in the current version). 

I hope I didn't miss something. I tested both approaches on different real world sequences and the new definition of the edge set is comprehensive IMO  but still ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant