Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Question on Dataset isSmaller(G,H) #3

Open
uvdsl opened this issue Dec 22, 2021 · 0 comments
Open

Question on Dataset isSmaller(G,H) #3

uvdsl opened this issue Dec 22, 2021 · 0 comments

Comments

@uvdsl
Copy link

uvdsl commented Dec 22, 2021

Hi,
I am currently trying to understand the algorithms better - your code helps a lot! Thank you very much.

While implementing my own interpretation of the algorithm, I stumbled upon the ordering of graphs, which you have implemented in the Dataset as isSmaller.

As I understood from the paper, the ordering itself was not specified so you had to come up with your own:

G < H if and only if G ⊂ H or there exists a triple t ∈ G \ H such that no triple t' ∈ H \ G exists where t' < t .

You implemented a shortcut with

// If HmG, i.e., H\G is empty then the second predicate is trivially true, so we are also done
 if( HmG.length === 0 ) return true;

While your implementation does exactly what you defined, I was wondering - more generally - the follwoing:
Let G = { (s,p,o), (s,p,x) } a graph consisting of two triples.
Let H = { (s,p,o) } a graph consisting of one triple such that H is a true subgraph of G.
Then:
GmH = {(s,p,x)} and HmG = { }.
Now, isSmaller(G,H) will return true as HmG is empty, just as you defined.

However, isSmaller(H,G) will also return true as H is a true subgraph of G, just as you defined.

Intuitively, I would have expected to first check for true subgraphs in both directions and second if none is a true subgraph of the other then to check if all triples in GmH are (lexicographically) smaller than all triples in HmG otherwise G is not smaller than H.

So, in a nutshell, I was expecting the check if H is subgraph of G, instead of the shortcut. The rest is fine to my understanding.
So: if( HmG.length === 0 ) return false;

Am I missing something? I would appreciate any clarifications and explanations why I am totally wrong about this :)
Cheers
Christoph

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant