[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [igraph] igraph union methods

From: venura.2.mendis
Subject: RE: [igraph] igraph union methods
Date: Mon, 13 Oct 2008 08:59:49 +0100

I am using the python API.

I was thinking of getting nodes of each graph (I'm only interested in merging 
nodes based on an label attribute) iterating through them calling 
get_adjedgelist method and adding them to the new graph checking to make sure 
that edge isn't already present. Ill be merging non directed graph.
Another option is to copy all the nodes+edges from both graphs to a new graph. 
Then to remove nodes that have duplicate label names and add new edge (if 
needed). Any opinions on what might better?


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Gábor Csárdi
Sent: 10 October 2008 17:41
To: Help for igraph users
Subject: Re: [igraph] igraph union methods

You did not tell us whether you're using R, Python or C. The set
methods are unfortunately not very good at using attributes, a
workaround solution would be to create edge lists from the graphs,
merge the edge lists and then create a new igraph.

In R, get.edgelist() can return a symbolic edgelist based on the
'name' attribute, then you can use rbind() and unique() to merge the
symbolic edge lists and finally create a new graph with
graph.edgelist(). You have to handle vertex and edge attributes
manually if you need to keep them.


On Fri, Oct 10, 2008 at 5:18 PM,  <address@hidden> wrote:
> Hi,
> I was wondering what was the best technique to merge multiple graphs.
> The union methods appears to merge the nodes based on node id. If I
> wanted to merge the graphs based on a label in the node, whats the best
> approach? I was thinking of adding both graphs, iterating through all
> the vertices and removing duplicate labels and adding new edge that
> belong to the ones that got removed. Is this a sensible approach?
> Thanks,
> Venura
> British Telecommunications plc
> Registered office: 81 Newgate Street London EC1A 7AJ
> Registered in England no. 1800000
> This electronic message contains information from British
> Telecommunications plc which may be privileged or confidential. The
> information is intended to be for the use of the individual(s) or entity
> named above. If you are not the intended recipient be aware that any
> disclosure, copying, distribution or use of the contents of this
> information is prohibited. If you have received this electronic message
> in error, please notify us by telephone or email (to the numbers or
> address above) immediately.
> Activity and use of the British Telecommunications plc email system is
> monitored to secure its effective operation and for other lawful
> business purposes. Communications using this system will also be
> monitored and may be recorded to secure effective operation and for
> other lawful business purposes.
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

Gabor Csardi <address@hidden>     UNIL DGM

igraph-help mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]