Check Presence of Specified Edges in Graph

3 views (last 30 days)
I have a digraph G. I also have another digraph H. I want to check whether the edges in H are present in G and highlight those edge that are in common. The command
> findedge(G, H.Edges.Endnodes(:, 1), H.Edges.Endnodes(:, 2))
does not work because it gives an error as soon as an edge in H is absent in G.
Thank you so much.
Kamal
  2 Comments
Steven Lord
Steven Lord on 28 Oct 2021
Are we allowed to assume that G and H have exactly the same set of nodes, and that the node named (for example) Alice in G is to be considered the same as the node named Alice in H? Or are you trying to do something more like identifying two subgraphs of those digraph objects that are isomorphic, where the node Alice in G could be "associated" with the node Bob in H?
Kamal Premaratne
Kamal Premaratne on 29 Oct 2021
Thank you Steven.
-- No, G and H may not have the same set of nodes.
-- If G has a node named "Alice" and H also has a node named "Alice", then yes, both are the same.
-- Perhaps it is better if I mention the particular dataset that I am working with.
C = digraph representing C elegance (https://wormwiring.org/pages/software.html).
G = a particular subgraph of C (which I generate via a spectral clutering algorithm).
H = Navigation circuit of C [Gray2005PNAS].
My main objective is to determine how much of the Nav circuit in H is captured in the subgraph G. The problem is that each node in H is a "proxy" for a set of nodes. For instace, node "AIB" in C is a proxy for both "AIBL" and "AIBR" that appear in C. So, an edge in H becomes a proxy for a set of edges in C. For instance, take the edge AIB > AIA in H. AIB is a proxy for AIBL and AIBR. Similarly, AIA is a proxy for AIAL and AIAR. So, the edge AIB > AIA in H is a proxy for 4 edges in C. Does G contain all 4, only some of the 4, or none of these 4 edges? That's what I want to find out.
Thank you so much.
Kamal
[Gray2005PNAS] Gray, Hill, Bargmann (2005). A circuit for navigation in Caenorhabditis elegans. PNAS 102(9) 3184–3191.

Sign in to comment.

Answers (1)

Shanmukha Voggu
Shanmukha Voggu on 26 Oct 2021
Hi Kamal,
There is an error in the command that you provided, please change "Endnodes" to "EndNodes", This will resolve the error hopefully.
The correct command is:
findedge(G, H.Edges.EndNodes(:, 1), H.Edges.EndNodes(:, 2));
Refer to this for more information.
Hope this helps!
  1 Comment
Kamal Premaratne
Kamal Premaratne on 28 Oct 2021
Thank you Shanmuka for pointing out the typo (it should be "EndNodes" and not Endnodes").
But, this does not resolve the problem. If any edge in H that is specified through H's EndNodes table is absent in G, MATLAB spits out an error.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!