Check Presence of Specified Edges in Graph

3 次查看(过去 30 天)
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 个评论
Steven Lord
Steven Lord 2021-10-28
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 2021-10-29
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.

请先登录,再进行评论。

回答(1 个)

Shanmukha Voggu
Shanmukha Voggu 2021-10-26
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 个评论
Kamal Premaratne
Kamal Premaratne 2021-10-28
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Construction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by