[Top][All Lists]

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

Re: [igraph] multiple edges and their attributes

From: Jey Narasimhan
Subject: Re: [igraph] multiple edges and their attributes
Date: Thu, 12 Mar 2015 16:44:21 -0400

Hi Tamas,

> The following snippet gives you the edge indices of all the edges in the
> graph
> with multiplicity > 1:
> eids = [index for index, is_multiple in enumerate(graph.is_multiple()) if
> is_multiple]

There is a small catch here; you are generating a large number of
eids, whereas in my attempt, I first filtered out the 'unique' edges,
then among them I find those with 'multiple' counterparts. I assumed
this is efficient for v.large graphs. Please correct me if I am wrong.

Now, I am linking another thread here for a quick question. Can I
replace the below code with your suggestion found in:
I am anyways using a list append operation, and your suggestion to use
a combinator function looks elegant.

>> for nm in nonmultedges:
>>     tempdict={}
>>     for name in nm.attribute_names():
>>         tempdict[name]=[]
>>     for e in myg1.es.select(_within=[nm.source, nm.target]):
>>         if e.tuple == nm.tuple:
>>             for name, val in e.attributes().iteritems():
>>                 tempdict[name].append(val)
>>         else:
>>             print 'something wrong'
>>     print tempdict

reply via email to

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