Check Presence of Specified Edges in Graph

조회 수: 3 (최근 30일)
Kamal Premaratne
Kamal Premaratne 2021년 10월 23일
댓글: Kamal Premaratne 2021년 10월 29일
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