Re: [igraph] Python-igraph: Possible memory leak in GraphBase.get_all_shortest_paths()

2015-12-07 Thread Tamas Nepusz
Hi,

I have tested it now on a Mac with the following code:

#!/usr/bin/env python

from psutil import Process
from igraph import Graph

import gc

self = Process()
g = Graph.GRG(400, 0.1)
for i in xrange(100):
sps = g.get_all_shortest_paths(0)
del sps
gc.collect()
mem_info = self.memory_info()
print i, mem_info.rss, mem_info.vms

The memory usage seems pretty stable to me; these are the results
(iteration count, resident set size, virtual memory size):

0 23523328 2532331520
1 24576000 2535403520
2 24584192 2535411712
3 23535616 2534363136
4 24584192 2535411712
5 25657344 2536476672
6 23560192 2534379520
7 23564288 2534379520
8 24788992 2534354944
9 25837568 2535403520
10 23744512 2533306368
11 24698880 259136
12 23773184 259136
13 24817664 2534387712
14 26710016 2535436288
15 23773184 259136
16 24825856 2534387712
17 24825856 2534387712
18 24821760 2534387712
19 23773184 259136
20 24821760 2534387712

So I don't think there's a leak there, at least not on Mac OS X. If
you can send me a small, self-contained program, equipped with a
similar instrumentation (see the code above) that seems to leak on
your machine, that would be great. (Note that you'll need to install
psutil from pip).

All the best,
T.


On Mon, Dec 7, 2015 at 9:29 AM,   wrote:
> Hi,
>
> I am developing a network analysis tool for evolutionary biology, which uses
> python-igraph. It appears that repeatedly calling get_all_shortest_paths()
> on the graph results in the consumption of available memory quite quickly. I
> have narrowed the memory leak down to get_all_shortest_paths() by using a
> memory profiler.
>
> I was using python-igraph-0.6 earlier and then upgraded to
> python-igraph-0.7.1.post6. The upgrade did not solve the problem. The OS is
> Ubuntu 14.04 LTS, with python 2.7.6.
>
> Has someone else come across the same issue?
>
> Regards,
> /Fahad
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Need help with plotting

2015-12-07 Thread Rajkumar Balakrishnan
Thank you Sir for the tip. I will get back to you after testing.

Raj

On Mon, Dec 7, 2015 at 8:42 AM, Gábor Csárdi  wrote:

> I guess the problem is that edge.betweenness.community interprets edge
> weights the opposite way. Small numbers mean short links, so strong
> connections. Use 1 / weights, maybe?
>
> Gabor
>
> On Mon, Dec 7, 2015 at 4:39 PM, Raj Balakrishnan  wrote:
>
>> Dear Gabor,
>>
>> Isn't the example I have included enough?
>>
>> Thanks,
>>
>> Raj
>>
>> Raj Balakrishnan
>> 
>> Sent from my mobile phone
>> --
>> From: Gábor Csárdi 
>> Sent: ‎07-‎12-‎2015 07:26
>> To: Help for igraph users 
>> Subject: Re: [igraph] Need help with plotting
>>
>> I am not sure what is going on here? Are you saying
>> that edge.betweenness.community is buggy? Possibly, but then please show us
>> why on some small example?
>>
>> Gabor
>>
>> On Mon, Dec 7, 2015 at 2:40 PM, Rk Lata  wrote:
>>
>>> Hi there,
>>>
>>> I am trying to plot self and cross reactions of bunch of proteins. I
>>> have three states: Positive=1, Negative=0 and Partial=0.5. When I plot the
>>> values in the matrix using the code below, I get the plot shown in Fig A. I
>>> am expecting a plot as in Fig B. (Please see the Figures attached).
>>> What should I do to make the weakly self reacting proteins (c & d)
>>> appear as a separate group and not in group with other  strongly self
>>> reacting proteins.
>>>
>>>
>>> abcdefghia1b01100c000.500d.50e00000f1110
>>> 0g11100h00011i00011
>>>
>>> m <- as.matrix(read.csv("C:/Users/balakrr1/Desktop/csv/n3.csv",
>>> header=TRUE, sep = ",", row.names = 1))
>>> g = graph.adjacency(m,mode="undirected",weighted=TRUE)
>>> g=simplify(g, remove.loops=TRUE)
>>> eb=edge.betweenness.community(g,directed=FALSE,weights=E(g)$weight)
>>> fr=layout.fruchterman.reingold(g)
>>> plot(eb,g,layout=fr,edge.width=E(g)$weight,main="Edge Betweenness")
>>>
>>>
>>> Thanks,
>>>
>>> Raj
>>>
>>>
>>> ___
>>> igraph-help mailing list
>>> igraph-help@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>>>
>>
>> ___
>> igraph-help mailing list
>> igraph-help@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Need help with plotting

2015-12-07 Thread Gábor Csárdi
I guess the problem is that edge.betweenness.community interprets edge
weights the opposite way. Small numbers mean short links, so strong
connections. Use 1 / weights, maybe?

Gabor

On Mon, Dec 7, 2015 at 4:39 PM, Raj Balakrishnan  wrote:

> Dear Gabor,
>
> Isn't the example I have included enough?
>
> Thanks,
>
> Raj
>
> Raj Balakrishnan
> 
> Sent from my mobile phone
> --
> From: Gábor Csárdi 
> Sent: ‎07-‎12-‎2015 07:26
> To: Help for igraph users 
> Subject: Re: [igraph] Need help with plotting
>
> I am not sure what is going on here? Are you saying
> that edge.betweenness.community is buggy? Possibly, but then please show us
> why on some small example?
>
> Gabor
>
> On Mon, Dec 7, 2015 at 2:40 PM, Rk Lata  wrote:
>
>> Hi there,
>>
>> I am trying to plot self and cross reactions of bunch of proteins. I have
>> three states: Positive=1, Negative=0 and Partial=0.5. When I plot the
>> values in the matrix using the code below, I get the plot shown in Fig A. I
>> am expecting a plot as in Fig B. (Please see the Figures attached).
>> What should I do to make the weakly self reacting proteins (c & d) appear
>> as a separate group and not in group with other  strongly self reacting
>> proteins.
>>
>>
>> abcdefghia1b01100c000.500d.50e00000f11100
>> g11100h00011i00011
>>
>> m <- as.matrix(read.csv("C:/Users/balakrr1/Desktop/csv/n3.csv",
>> header=TRUE, sep = ",", row.names = 1))
>> g = graph.adjacency(m,mode="undirected",weighted=TRUE)
>> g=simplify(g, remove.loops=TRUE)
>> eb=edge.betweenness.community(g,directed=FALSE,weights=E(g)$weight)
>> fr=layout.fruchterman.reingold(g)
>> plot(eb,g,layout=fr,edge.width=E(g)$weight,main="Edge Betweenness")
>>
>>
>> Thanks,
>>
>> Raj
>>
>>
>> ___
>> igraph-help mailing list
>> igraph-help@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Need help with plotting

2015-12-07 Thread Raj Balakrishnan
Dear Gabor,

Isn't the example I have included enough?

Thanks,

Raj 

Raj Balakrishnan

Sent from my mobile phone 

-Original Message-
From: "Gábor Csárdi" 
Sent: ‎07-‎12-‎2015 07:26
To: "Help for igraph users" 
Subject: Re: [igraph] Need help with plotting

I am not sure what is going on here? Are you saying that 
edge.betweenness.community is buggy? Possibly, but then please show us why on 
some small example?


Gabor


On Mon, Dec 7, 2015 at 2:40 PM, Rk Lata  wrote:

Hi there,


I am trying to plot self and cross reactions of bunch of proteins. I have three 
states: Positive=1, Negative=0 and Partial=0.5. When I plot the values in the 
matrix using the code below, I get the plot shown in Fig A. I am expecting a 
plot as in Fig B. (Please see the Figures attached). 
What should I do to make the weakly self reacting proteins (c & d) appear as a 
separate group and not in group with other  strongly self reacting proteins. 




abcdefghi
a1
b01100
c000.500
d.50
e00000
f11100
g11100
h00011
i00011




m <- as.matrix(read.csv("C:/Users/balakrr1/Desktop/csv/n3.csv", header=TRUE, 
sep = ",", row.names = 1))
g = graph.adjacency(m,mode="undirected",weighted=TRUE)
g=simplify(g, remove.loops=TRUE)
eb=edge.betweenness.community(g,directed=FALSE,weights=E(g)$weight)

fr=layout.fruchterman.reingold(g)
plot(eb,g,layout=fr,edge.width=E(g)$weight,main="Edge Betweenness")





Thanks,


Raj



___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Need help with plotting

2015-12-07 Thread Gábor Csárdi
I am not sure what is going on here? Are you saying
that edge.betweenness.community is buggy? Possibly, but then please show us
why on some small example?

Gabor

On Mon, Dec 7, 2015 at 2:40 PM, Rk Lata  wrote:

> Hi there,
>
> I am trying to plot self and cross reactions of bunch of proteins. I have
> three states: Positive=1, Negative=0 and Partial=0.5. When I plot the
> values in the matrix using the code below, I get the plot shown in Fig A. I
> am expecting a plot as in Fig B. (Please see the Figures attached).
> What should I do to make the weakly self reacting proteins (c & d) appear
> as a separate group and not in group with other  strongly self reacting
> proteins.
>
>
> abcdefghia1b01100c000.500d.50e00000f11100g
> 11100h00011i00011
>
> m <- as.matrix(read.csv("C:/Users/balakrr1/Desktop/csv/n3.csv",
> header=TRUE, sep = ",", row.names = 1))
> g = graph.adjacency(m,mode="undirected",weighted=TRUE)
> g=simplify(g, remove.loops=TRUE)
> eb=edge.betweenness.community(g,directed=FALSE,weights=E(g)$weight)
> fr=layout.fruchterman.reingold(g)
> plot(eb,g,layout=fr,edge.width=E(g)$weight,main="Edge Betweenness")
>
>
> Thanks,
>
> Raj
>
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] make check fails 45 times

2015-12-07 Thread Gábor Csárdi
We don't actually test on cygwin. I suspect that most of these
failures are not serious. They seem linking errors from the build
system.

If your program links OK, everything is fine, I think.

Gabor


On Tue, Nov 10, 2015 at 5:58 PM, MARIA PEREDA GARCIA  wrote:
> Hello,
>
>
>
> I need help with the igraph installation via Cygwin in Windows 8.1
>
>
>
> After successfully complete
>
> ./configure
>
> make
>
> make check
>
>
>
> I have the following tests that have failed (I repeated the process twice)
>
>
>
> 46: Query many edge ids (igraph_get_eids):  FAILED (basic.at:79)
>
>
>
> Iterators aka vertex and edge sequences
>
>
>
> 47: Vertices in a vector (igraph_vs_vector):ok
>
> 48: Non-adjacent vertices (igraph_vs_nonadj):   ok
>
> 49: Sequence (igraph_vs_seq):   ok
>
> 50: Edges given by end points (igraph_es_pairs):ok
>
> 51: Edges in a path (igraph_es_path):   ok
>
>
>
> Structure generators
>
>
>
> 52: Simple graph creation (igraph_create):  ok
>
> 53: Barabasi-Albert model (igraph_barabasi_game):   FAILED
> (structure_generators.at:31)
>
> 54: More Barabasi-Albert model (igraph_barabasi_game): FAILED
> (structure_generators.at:36)
>
> 55: Erdos-Renyi model (igraph_erdos_renyi_game):FAILED
> (structure_generators.at:41)
>
> 56: Degree sequence (igraph_degree_sequence_game):  FAILED
> (structure_generators.at:46)
>
> 57: k-regular graphs (igraph_k_regular_game):   FAILED
> (structure_generators.at:51)
>
> 58: Growing random (igraph_growing_random_game):ok
>
> 59: Preference model (igraph_preference_game):  FAILED
> (structure_generators.at:61)
>
> 60: From adjacency matrix (igraph_adjacency):   ok
>
> 61: From weighted adjacency matrix (igraph_weighted_adjacency): ok
>
> 62: Star graph (igraph_star):   ok
>
> 63: Lattice graph (igraph_lattice): FAILED
> (structure_generators.at:81)
>
> 64: Ring graph (igraph_ring):   FAILED
> (structure_generators.at:86)
>
> 65: Tree graph (igraph_tree):   ok
>
> 66: Full graph (igraph_full):   ok
>
> 67: Graph atlas (igraph_atlas): ok
>
> 68: Small graph (igraph_small): ok
>
> 69: Geomeric random graphs (igraph_grg_game):   FAILED
> (structure_generators.at:111)
>
> 70: Graphs in LCF notation (igraph_lcf{,_vector}):  FAILED
> (structure_generators.at:116)
>
> 71: Watts-Strogatz graphs (igraph_watts_strogatz_game): FAILED
> (structure_generators.at:121)
>
>
>
> Structural properties
>
>
>
> 72: Two vertices connected by an edge:  ok
>
> 73: Density of a graph (igraph_density):FAILED
> (structural_properties.at:31)
>
> 74: Diameter of a graph (igraph_diameter):  FAILED
> (structural_properties.at:36)
>
> 75: Average geodesic length (igraph_average_path_length):  FAILED
> (structural_properties.at:41)
>
> 76: Google PageRank (igraph_pagerank):  FAILED
> (structural_properties.at:46)
>
> 77: Random rewiring (igraph_rewire):ok
>
> 78: Get the shortest paths (igraph_get_shortest_paths):  ok
>
> 79: Get the shortest paths #2 (igraph_get_shortest_paths):  ok
>
> 80: Weighted shortest paths (Dijkstra): ok
>
> 81: Weighted shortest paths (Bellman-Ford): ok
>
> 82: Get the weighted shortest paths (Dijkstra): ok
>
> 83: Get all weighted shortest paths (Dijkstra): ok
>
> 84: Shortest path wrappers for single target node:  ok
>
> 85: Betweenness (igraph_betweenness):   FAILED
> (structural_properties.at:96)
>
> 86: Betweenness, big integers (igraph_betweenness):  FAILED
> (structural_properties.at:101)
>
> 87: Edge betweenness (igraph_edge_betweenness): FAILED
> (structural_properties.at:107)
>
> 88: Transitivity (igraph_transitivity): ok
>
> 89: Local transitivity (igraph_local_transitivity):  FAILED
> (structural_properties.at:117)
>
> 90: Reciprocity (igraph_reciprocity):   ok
>
> 91: Minimum spanning tree (igraph_minimum_spanning_tree_*):  FAILED
> (structural_properties.at:128)
>
> 92: Cocitation and bibcoupling (igraph_cocitation,igraph_bibcoupling): ok
>
> 93: Similarity coefficients (igraph_similarity_*):  ok
>
> 94: Simplification of non-simple graphs (igraph_simplify):  ok
>
> 95: Topological sorting (igraph_topological_sorting, igraph_is_dag):  ok
>
> 96: Feedback arc sets, Eades heuristics (igraph_feedback_arc_set):  ok
>
> 97: Feedback arc sets, integer programming (igraph_feedback_arc_set):  ok
>
> 98: Loop edges test (igraph_is_loop):   ok
>
> 99: Multiple edges test (igraph_is_multiple):   ok
>
> 100: Multiple edges test (igraph_has_multiple):  ok
>
> 101: Girth (igraph_girth):   ok
>
> 102: Convergence degree (igraph_convergence_degree):  ok
>
> 103: Assortativity coefficient (igraph_assortativity):  ok
>
> 104: Average nearest neighbor degree (igraph_avg_nearest_neighbor_degree

Re: [igraph] directed graph

2015-12-07 Thread Gábor Csárdi
This is not possible currently. Gabor

On Fri, Nov 20, 2015 at 4:39 PM, Giulia Rossello
 wrote:
> dear all,
> I am a new user of R. I would like to know if is possible to compute average
> nearest neighbor strength/degree and weighted/unweighted clustering
> coefficient taking into account also the direction. it is available an
> extension of functions graph.knn and transitivity?
> Thank you in advance
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Need help with plotting

2015-12-07 Thread Rk Lata
Hi there,

I am trying to plot self and cross reactions of bunch of proteins. I have
three states: Positive=1, Negative=0 and Partial=0.5. When I plot the
values in the matrix using the code below, I get the plot shown in Fig A. I
am expecting a plot as in Fig B. (Please see the Figures attached).
What should I do to make the weakly self reacting proteins (c & d) appear
as a separate group and not in group with other  strongly self reacting
proteins.

abcdefghia1b01100c000.500d.50e00000f11100g00
0011100h00011i00011

m <- as.matrix(read.csv("C:/Users/balakrr1/Desktop/csv/n3.csv",
header=TRUE, sep = ",", row.names = 1))
g = graph.adjacency(m,mode="undirected",weighted=TRUE)
g=simplify(g, remove.loops=TRUE)
eb=edge.betweenness.community(g,directed=FALSE,weights=E(g)$weight)
fr=layout.fruchterman.reingold(g)
plot(eb,g,layout=fr,edge.width=E(g)$weight,main="Edge Betweenness")


Thanks,

Raj
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] What exactly does igraph_transitivity_undirected() compute for directed graphs?

2015-12-07 Thread Gábor Csárdi
On Mon, Dec 7, 2015 at 1:28 PM, Szabolcs Horvát  wrote:
[...]
> Do you think a patch that converts directed graphs to undirected
> simple graphs before computing the local clustering coefficient would
> be appropriate here?

Converting the whole graph is not a good solution, because that is
O(n+m), and local transitivity is O(1).

Converting the graph locally, at the queried vertex, is maybe a better
idea, but also harder to implement. So we might as well modify the
local transitivity code.

Gabor

> On 7 December 2015 at 13:16, Gábor Csárdi  wrote:
>> I am not sure if it is defined. I guess this is just a case when the
>> behavior is not defined for multi-graphs.
>>
>> Gabor
>>
>> On Mon, Dec 7, 2015 at 12:14 PM, Szabolcs Horvát  wrote:
>>> Thank you for the explanation.
>>>
>>> Could you elaborate a bit on how igraph defines the local clustering
>>> coefficient when multiple (parallel) edges are present?
>>>
>>> On 7 December 2015 at 12:56, Gábor Csárdi  wrote:
 It's because of the multiple edges in the first graph. I.e.:

> transitivity(as.undirected(g, mode = "each"),"local")
 [1] 0.333 0.333 1.000

 Gabor

 On Mon, Dec 7, 2015 at 10:05 AM, Szabolcs Horvát  
 wrote:
> Hello,
>
> What precisely does igraph_transitivity_undirected() compute for
> directed graphs?
>
> The C documentation states that
>
> "Directed graphs are considered as undirected ones."
>
> but this is not exactly the case.
>
> With an example using the R interface (for simplicity),
>
>> g<-make_graph(c(1,2, 2,1, 2,3, 3,1))
>> transitivity(g,"local")
> [1] 0.333 0.333 1.000
>
>> transitivity(as.undirected(g),"local")
> [1] 1 1 1
>
> Can someone clarify what precisely is computed in the directed case?
>
> Szabolcs
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help

 ___
 igraph-help mailing list
 igraph-help@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>>> ___
>>> igraph-help mailing list
>>> igraph-help@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>> ___
>> igraph-help mailing list
>> igraph-help@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] What exactly does igraph_transitivity_undirected() compute for directed graphs?

2015-12-07 Thread Szabolcs Horvát
Thanks again for the clarification!  I think what actually happens is
that the neighbours of a vertex are counted as the degree of that
vertex (which is not the same thing for multigraphs).

Do you think a patch that converts directed graphs to undirected
simple graphs before computing the local clustering coefficient would
be appropriate here?

On 7 December 2015 at 13:16, Gábor Csárdi  wrote:
> I am not sure if it is defined. I guess this is just a case when the
> behavior is not defined for multi-graphs.
>
> Gabor
>
> On Mon, Dec 7, 2015 at 12:14 PM, Szabolcs Horvát  wrote:
>> Thank you for the explanation.
>>
>> Could you elaborate a bit on how igraph defines the local clustering
>> coefficient when multiple (parallel) edges are present?
>>
>> On 7 December 2015 at 12:56, Gábor Csárdi  wrote:
>>> It's because of the multiple edges in the first graph. I.e.:
>>>
 transitivity(as.undirected(g, mode = "each"),"local")
>>> [1] 0.333 0.333 1.000
>>>
>>> Gabor
>>>
>>> On Mon, Dec 7, 2015 at 10:05 AM, Szabolcs Horvát  wrote:
 Hello,

 What precisely does igraph_transitivity_undirected() compute for
 directed graphs?

 The C documentation states that

 "Directed graphs are considered as undirected ones."

 but this is not exactly the case.

 With an example using the R interface (for simplicity),

> g<-make_graph(c(1,2, 2,1, 2,3, 3,1))
> transitivity(g,"local")
 [1] 0.333 0.333 1.000

> transitivity(as.undirected(g),"local")
 [1] 1 1 1

 Can someone clarify what precisely is computed in the directed case?

 Szabolcs

 ___
 igraph-help mailing list
 igraph-help@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/igraph-help
>>>
>>> ___
>>> igraph-help mailing list
>>> igraph-help@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>> ___
>> igraph-help mailing list
>> igraph-help@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] What exactly does igraph_transitivity_undirected() compute for directed graphs?

2015-12-07 Thread Gábor Csárdi
I am not sure if it is defined. I guess this is just a case when the
behavior is not defined for multi-graphs.

Gabor

On Mon, Dec 7, 2015 at 12:14 PM, Szabolcs Horvát  wrote:
> Thank you for the explanation.
>
> Could you elaborate a bit on how igraph defines the local clustering
> coefficient when multiple (parallel) edges are present?
>
> On 7 December 2015 at 12:56, Gábor Csárdi  wrote:
>> It's because of the multiple edges in the first graph. I.e.:
>>
>>> transitivity(as.undirected(g, mode = "each"),"local")
>> [1] 0.333 0.333 1.000
>>
>> Gabor
>>
>> On Mon, Dec 7, 2015 at 10:05 AM, Szabolcs Horvát  wrote:
>>> Hello,
>>>
>>> What precisely does igraph_transitivity_undirected() compute for
>>> directed graphs?
>>>
>>> The C documentation states that
>>>
>>> "Directed graphs are considered as undirected ones."
>>>
>>> but this is not exactly the case.
>>>
>>> With an example using the R interface (for simplicity),
>>>
 g<-make_graph(c(1,2, 2,1, 2,3, 3,1))
 transitivity(g,"local")
>>> [1] 0.333 0.333 1.000
>>>
 transitivity(as.undirected(g),"local")
>>> [1] 1 1 1
>>>
>>> Can someone clarify what precisely is computed in the directed case?
>>>
>>> Szabolcs
>>>
>>> ___
>>> igraph-help mailing list
>>> igraph-help@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>> ___
>> igraph-help mailing list
>> igraph-help@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] What exactly does igraph_transitivity_undirected() compute for directed graphs?

2015-12-07 Thread Szabolcs Horvát
Thank you for the explanation.

Could you elaborate a bit on how igraph defines the local clustering
coefficient when multiple (parallel) edges are present?

On 7 December 2015 at 12:56, Gábor Csárdi  wrote:
> It's because of the multiple edges in the first graph. I.e.:
>
>> transitivity(as.undirected(g, mode = "each"),"local")
> [1] 0.333 0.333 1.000
>
> Gabor
>
> On Mon, Dec 7, 2015 at 10:05 AM, Szabolcs Horvát  wrote:
>> Hello,
>>
>> What precisely does igraph_transitivity_undirected() compute for
>> directed graphs?
>>
>> The C documentation states that
>>
>> "Directed graphs are considered as undirected ones."
>>
>> but this is not exactly the case.
>>
>> With an example using the R interface (for simplicity),
>>
>>> g<-make_graph(c(1,2, 2,1, 2,3, 3,1))
>>> transitivity(g,"local")
>> [1] 0.333 0.333 1.000
>>
>>> transitivity(as.undirected(g),"local")
>> [1] 1 1 1
>>
>> Can someone clarify what precisely is computed in the directed case?
>>
>> Szabolcs
>>
>> ___
>> igraph-help mailing list
>> igraph-help@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] What exactly does igraph_transitivity_undirected() compute for directed graphs?

2015-12-07 Thread Gábor Csárdi
It's because of the multiple edges in the first graph. I.e.:

> transitivity(as.undirected(g, mode = "each"),"local")
[1] 0.333 0.333 1.000

Gabor

On Mon, Dec 7, 2015 at 10:05 AM, Szabolcs Horvát  wrote:
> Hello,
>
> What precisely does igraph_transitivity_undirected() compute for
> directed graphs?
>
> The C documentation states that
>
> "Directed graphs are considered as undirected ones."
>
> but this is not exactly the case.
>
> With an example using the R interface (for simplicity),
>
>> g<-make_graph(c(1,2, 2,1, 2,3, 3,1))
>> transitivity(g,"local")
> [1] 0.333 0.333 1.000
>
>> transitivity(as.undirected(g),"local")
> [1] 1 1 1
>
> Can someone clarify what precisely is computed in the directed case?
>
> Szabolcs
>
> ___
> igraph-help mailing list
> igraph-help@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/igraph-help

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


[igraph] Python-igraph: Possible memory leak in GraphBase.get_all_shortest_paths()

2015-12-07 Thread fahad . khalid
Hi,

I am developing a network analysis tool for evolutionary biology, which uses 
python-igraph. It appears that repeatedly calling get_all_shortest_paths() on 
the graph results in the consumption of available memory quite quickly. I have 
narrowed the memory leak down to get_all_shortest_paths() by using a memory 
profiler.

I was using python-igraph-0.6 earlier and then upgraded to 
python-igraph-0.7.1.post6. The upgrade did not solve the problem. The OS is 
Ubuntu 14.04 LTS, with python 2.7.6.

Has someone else come across the same issue?

Regards,
/Fahad
___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


[igraph] What exactly does igraph_transitivity_undirected() compute for directed graphs?

2015-12-07 Thread Szabolcs Horvát
Hello,

What precisely does igraph_transitivity_undirected() compute for
directed graphs?

The C documentation states that

"Directed graphs are considered as undirected ones."

but this is not exactly the case.

With an example using the R interface (for simplicity),

> g<-make_graph(c(1,2, 2,1, 2,3, 3,1))
> transitivity(g,"local")
[1] 0.333 0.333 1.000

> transitivity(as.undirected(g),"local")
[1] 1 1 1

Can someone clarify what precisely is computed in the directed case?

Szabolcs

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help


Re: [igraph] Direction of edges along shortest path

2015-12-07 Thread Tamas Nepusz
> But how can I get the directions of the edges that are passed along the way
> for each path?
If your network is not too large, the easiest is probably to:

1. Convert your original graph into another one where each edge is
present in both directions:

g2 = g.as_undirected()
g2.to_directed(mutual=True)

2. Call g2.get_shortest_paths(v=0, weights="length", output="vpath") -
this will give you each path as a list of vertex indices

3. For each consecutive vertex index pair (i, j), check whether there
is an edge between them in present in g. If so, this is an edge that
follows the directions in the original graph, otherwise it goes
against them:

from itertools import izip

def pairs(iterable):
return izip(iterable, iterable[1:])

for path in shortest_paths_from_some_source_vertex:
edge_follows_direction = [g.are_connected(u, v) for u, v in pairs(path)]

Best,
T.

___
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help