Sunday, 15 April 2012

subgraph from selected vertices using python-igraph -


I am trying to create a sorted subfraph which includes upper part from a graph with verticality center.

This is my view:

  & gt; & Gt; & Gt; Import igraph as Ig; gt; & Gt; & Gt; Np & gt; & Gt; & Gt; Ig.summary (graph) IGRAPH DNW- 9358 35488 - + Att: ID (V), Label (V), Name (V), Weight (E) & gt; & Gt; & Gt; Btwn = graph.betweenness (weight = 'weight') & gt; & Gt; & Gt; Ntile = np.percentile (btwn, 95)> gt; & Gt; & Gt; Pruned_vs = graph.vs.select ([v & gt; = ntile btwn for vt])> gt; & Gt; & Gt; Pruned_graph = graph.subgraph (pruned_vs)  

Everything is working fine though, the resulting subgraph is not well-formed.

  & gt; & Gt; & Gt; IGRAPH DNW- 0 + + attr: id (v), label (v), name (v), weight (e)  

I have tried implementation Changing attribute to subtraction but this did not help. What am I missing?

This row is incorrect:

  pruned_vs = Graph.vs. Select  

The list understands that you pass as the argument () to a ( gt; = ntile for v for btwn) Boolean vector return, which is unsupported by graph.vs.select () - you need to pass the vector in which there are indices for nodes for selection. It can be done as follows:

  pruned_vs = graph.vs.select (v for v, b to btwn, if b> = ntile])  

No comments:

Post a Comment