Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this library work with MultiDiGraph subgraph isomorphism search? #32

Open
enjoysmath opened this issue Sep 20, 2022 · 18 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@enjoysmath
Copy link

Hi,

I'm wondering if in networkx or this library I'm limited to DiGraph subgraph isomorphism search?

I need multi.

Thanks.

@enjoysmath
Copy link
Author

I see networkx has a MultiDigraphMatcher, it's just not in their documentation. Does this library do that? You should be explicit about such limitations. :)

@j6k4m8
Copy link
Member

j6k4m8 commented Sep 20, 2022

Hi @enjoysmath! It's on my roadmap (and I'm not actually quite sure what would happen if you tried it now) — I haven't explicitly added support for multigraphs though.

In the meantime, something like DotMotif does support multigraph-host search, directed and undirected, because it handles multiedges in a postprocessing step. What is your current use-case?

[EDIT] Looks like we currently throw an error on multigraphs, but it seems like not a terribly difficult thing to fix. I will bump this up on my priority if this is a useful feature to you!

@j6k4m8 j6k4m8 self-assigned this Sep 20, 2022
@j6k4m8 j6k4m8 added the enhancement New feature or request label Sep 20, 2022
@enjoysmath
Copy link
Author

enjoysmath commented Sep 20, 2022 via email

@j6k4m8
Copy link
Member

j6k4m8 commented Sep 20, 2022

That sounds very cool — doesn't look like the attachment uploaded though!

I think that the subgraph isomorphism work in networkx is also relatively small in terms of LOC; the majority of our performance benefit comes from (I think) the data structure that we use to queue candidate motifs, as well as the lower overhead of NOT using classes in our implementation. Our implementation is also a queue-based data-structure instead of a tree-based recursion, and we exit early if attributes don't match... Other than that, I'm not exactly sure what the differences are besides the runtime :)

@j6k4m8
Copy link
Member

j6k4m8 commented Sep 20, 2022

As a quick aside on software architecture — it might be worthwhile making MANY small CD queries, rather than one query on a giant database graph; at least in the VF2 and grandiso implementations, subgraph search is exponential in terms of number of edges, so lots of small graphs are faster than one big one, if they share any vertices at all.

And then you can parallelize those individual searches without too much pain. Just a thought! (Happy to discuss this more if you like!) It might also resolve the need to support multigraphs? Though I'm well out of my depth on that part :)

@enjoysmath
Copy link
Author

enjoysmath commented Sep 20, 2022 via email

@enjoysmath
Copy link
Author

enjoysmath commented Sep 20, 2022 via email

@enjoysmath
Copy link
Author

That is interesting, I'll stick with networkx until your library works with MultiDiGraphs. Ping me when it does.

Here is an infinite supply of screenshots, my friend :)

https://www.youtube.com/channel/UCkwSzrP8pr2uN4Mu04ktipg

Ignore the Django/Neo4j videos. I still have that code up, but I'm focusing on this desktop app.

@j6k4m8
Copy link
Member

j6k4m8 commented Sep 20, 2022

I'm definitely interested, and I'd love to figure out a way to make this code useful for you. (PS: Is a Rust implementation interesting, or just C?)

I know that, but because of disconnectivity, the run times should come out about the same.

Gotcha — in that case, probably even a little better to put them in the same graph to avoid the overhead of the queries themselves!

Neo4j is definitely super heavy per-query, you're right that it's a non-starter for you here. Bummer!!

Do you have any resources where I could read up on CDs? I didn't see any multiedges in the videos that I took a look at so far (except for possibly here), but maybe I'm not looking in the right place because I don't quite understand the underlying math..?

Or are they purely a property of the larger query graph? i.e., do you need multiedge support in both host and motif?

@enjoysmath
Copy link
Author

enjoysmath commented Sep 20, 2022 via email

@enjoysmath
Copy link
Author

enjoysmath commented Sep 20, 2022 via email

@j6k4m8
Copy link
Member

j6k4m8 commented Sep 20, 2022

Aha, I see — is this a requirement for other operations in networkx? (At least as far as grandiso is concerned, you can add edge attributes that are the same as node attributes)

Would it be helpful to do a zoom call or chat on slack / email or something? I'd love to make this useful for CD work :)

@enjoysmath
Copy link
Author

enjoysmath commented Sep 20, 2022 via email

@j6k4m8
Copy link
Member

j6k4m8 commented Sep 20, 2022

Oops sorry — timing error :) I meant the edge attributes! I'll shoot you an email once my qualifying exam wraps up; let's chat!!

@enjoysmath
Copy link
Author

enjoysmath commented Sep 20, 2022 via email

@enjoysmath
Copy link
Author

enjoysmath commented Oct 11, 2022 via email

@yashpatel1994
Copy link

yashpatel1994 commented Jul 27, 2023

Hi @j6k4m8,

I was wondering whether you had any time to work on the issue of finding motifs in MultiDiGraph instances. From the discussion above, I do see that you recommended dotmotif as an alternative. Unfortunately, it does not suit my use case because both my motif and host are networkx objects.

Thanks!

Best,
Zakuta

@j6k4m8
Copy link
Member

j6k4m8 commented Aug 1, 2023

Hi @Zakuta! I haven't had a chance to dive into this implementation yet, though I appreciate you bumping this issue since it'll help me prioritize next steps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants