Intersection of two networks with different set sizes

118 views
Skip to first unread message

Lucas Carvalho

unread,
Feb 28, 2021, 10:57:47 AM2/28/21
to networkx-discuss
Hello everyone,

I generated two biological networks through two different lists of genes.

I can generate both networks with networkx, but I cannot identify their intersections or differences. The error occurs: "NetworkXError: Node sets of graphs are not equal".

I understand that networkx functions work for equal set sizes.
Is there a strategy to compare two networks with different set sizes using networkx?

Thanks!
Best regards,

Edip Celebioglu

unread,
Feb 28, 2021, 11:15:27 AM2/28/21
to networkx...@googlegroups.com
Hi Lucas.

Have you tried (-) subtracting node sets? Not sure if it will help, wanted to let you know in case. Nodes are sets so set operations might help.

Best regards.
Edip

--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/69257499-66ae-4183-8c2f-cafaae3758a5n%40googlegroups.com.

Lucas Carvalho

unread,
Feb 28, 2021, 11:53:09 AM2/28/21
to networkx...@googlegroups.com
Hello Edip,

Thanks for the answer. The difference between the nodes I made the operation (-), just like you mentioned.

Now for the edges, I intend to create a dictionary that uses the edge as an index. So, I can compare them.

The network plot needs to be drawn up, in this case, to contain the equality and difference information (edges and nodes). But this is all very manual.

If I had something faster it would be great.

Best regards, 
Lucas. 


You received this message because you are subscribed to a topic in the Google Groups "networkx-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/networkx-discuss/jQohy7R9Vm8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/CAAzq%2B2uPYm26n2gd5H0BxU76tdPRWvqqUS3f9q7cxmC5ghKzpA%40mail.gmail.com.

Edip Celebioglu

unread,
Feb 28, 2021, 12:54:36 PM2/28/21
to networkx...@googlegroups.com
Hi Lucas,

I used the node edit path (or preferably optimize_edit_paths) for the same purpose (not biology related) except drawing it, I have found it very useful. :) You could use custom comparison functions as well in this edit path functions, so you could use the label or other node/edge attributes to compare the graphs for equality etc.

The edit path uses cost to select the cheapest edit paths, I got confusing results initially and I had to read the source code to further understand the mechanics.

Hope it helps.
Best regards.
Edip

 

Lucas Carvalho

unread,
Feb 28, 2021, 4:01:55 PM2/28/21
to networkx...@googlegroups.com
Hi Edip,

that's interesting. I didn't know about this function. I was reading about and maybe it helps. Isomorphism in graphs ...

Thanks again! 

Best Regards, Lucas. 

Reply all
Reply to author
Forward
0 new messages