Hi, > Is there a similar function to as_edgelist( graph ) but only providing edges > incident to the specified vertices in the following way: as_edgelist( graph, > vertices ). incident(graph, vertex) and incident_edges(graph, vertices) does exactly that if I remember correctly.
> This is based on my experience that the numeric matrix returned by > as_edgelist is more convenient and faster to further process than list. It could be the case, but I'm not sure whether that's the real bottleneck in your code. Have you tried profiling it to see which parts are responsible for most of the execution time? > On the other hand, I'm using python as well. So what is situation on the > python side? They both rely on the same set of core C routines so I don't think there would be a big difference - one possible optimization would be to use Python's built-in set type for set intersections and exclusions (basically you pre-compute the incidence list for each vertex as a Python dict mapping vertex indices to sets). Maybe you could also use another dict as a cache that memorizes the computed indices for edges incident on a specific edge so you don't calculate it over and over again when your random walker is stuck in a part of a graph - but the benefits of such a solution depend on the structure of your graph T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
