[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] an adhoc edge property similar to weight
From: 
heroxbd 
Subject: 
[igraph] an adhoc edge property similar to weight 
Date: 
Mon, 30 May 2011 19:22:47 +0900 
Useragent: 
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) 
Dear Guys and Girls,
I am using igraph (via python) for several months for graph
clustering. It really rocks!
I have a tree with weightededges, and want to calculate weight times
the smaller number of vertices of the two components if the edge is
deleted:
,
 def sep(graph, e):
 h = copy(graph)
 w = h.es[e]['weight']
 h.delete_edges(e)
 return w * min(h.components().sizes())

 # 'graph' is the tree I am dealing with
 ss = [sep(graph,x) for x in range(len(graph.es))]
`
My questiones are:
1. Is this a known (and named) property in graph theory? If so, what is
it?
2. My piece of code is very inefficient if I calculate this for all the
edges, as shown above. If the graph becomes 50000 edges and vertices,
memory consumption becomes huge. Do you have some suggestions for
optimizing?
Cheers,

XU Benda
Research Center for Neutrino Science
Tohoku University
JAPAN
http://www.awa.tohoku.ac.jp/~benda
 [igraph] an adhoc edge property similar to weight,
heroxbd <=