[BioC] a question about graph in R

Seth Falcon sfalcon at fhcrc.org
Tue Nov 24 01:53:47 CET 2009


Hi,

[replying on the list]

On 11/22/09 12:58 AM, jiabao xu wrote:
> Hi Seth Falcon,
>     thanks for your reply .G1 and G2 are parts of G.and union(G1,G2) is
> G,If i know the G  and G2 ,how to get G1.I am sorry for that i didn't
> describle clear in the last  email.

Hmm, I'm still a bit confused.  Do you know that G1 and G2 are disjoint?

I don't think there is currently a set difference type operations in the 
graph package which might be what you want.

You can find the nodes as:

    g1_nodes = setdiff(nodes(G), nodes(G2))  # these will be the G1 nodes

Then perhaps you can just do subGraph(G, g1_nodes)

Hope that helps some.

+ seth

>
> On Sun, Nov 22, 2009 at 12:11 PM, Seth Falcon <sfalcon at fhcrc.org
> <mailto:sfalcon at fhcrc.org>> wrote:
>
>     Hi Jiabao,
>
>
>     On 11/20/09 11:26 PM, jiabao xu wrote:
>
>         hello,everyone:
>         I have two graphs: G1(V,E) ,G2(V2,E2) (V2∈V,E2∈E),how to got the
>         G(V1,E1)
>         ,G1∪G2=G,V1∪V2=V,E1∪E2=E.
>
>
>     The graph package has intersection() and union() functions that may
>     give you what you want.
>
>     If not, perhaps you can give a more detailed example for what you
>     want.  In particular, I'm not sure I understand your notation.
>       Looks to me like you have defined G2 such that V2 is a subset of V
>     and E2 a subset of E and G1 is (V, E).  So then union(G1, G2) is
>     just G1?
>
>     + seth
>
>


-- 
Seth Falcon
Program in Computational Biology | Fred Hutchinson Cancer Research Center



More information about the Bioconductor mailing list