[Top][All Lists]

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

[igraph] multiple edges and their attributes

From: Jey Narasimhan
Subject: [igraph] multiple edges and their attributes
Date: Wed, 11 Mar 2015 16:17:03 -0400


I am looking for an efficient way to extract all the multiple edges
and working on them before deleting them from the graph.

I have come up with the following way to extract them, but since I am
a beginner of igraph, I am not sure about the efficiency, or if some
operations could be done in less steps, perhaps using simplify
function. Please comment.

import igraph as ig
import numpy as np

myg1 = ig.Graph.Read_GraphML(sys.argv[1])
multval = myg1.is_multiple()
locsuniqval = np.where(np.asarray(multval)==False)[0]
uniqedges_cm = myg1.count_multiple(locsuniqval)
uniq_cm = np.where(np.asarray(uniqedges_cm)>1)[0]
nonmultedges = ig.EdgeSeq(myg1, locsuniqval[uniq_cm])
for nm in nonmultedges:
    for name in nm.attribute_names():
    for e in myg1.es.select(_within=[nm.source, nm.target]):
        if e.tuple == nm.tuple:
            for name, val in e.attributes().iteritems():
            print 'something wrong'
    print tempdict

reply via email to

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