[Top][All Lists]

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

Re: [igraph] graph operations

From: Jey Narasimhan
Subject: Re: [igraph] graph operations
Date: Tue, 10 Mar 2015 11:46:53 -0400

> Message-ID: <address@hidden>
>> 1) I am looking for the definitions of graph operations such as
>> intersection, union, etc., but could not find them in the API
>> documentation. Is there any place where I can find their definitions?
> In cases when the documentation of the Python interface is not detailed
> enough,
> you can try to find the corresponding functions in the documentation of the
> C core:
> http://igraph.org/c/doc/igraph-Operators.html
> Although, to be honest, it seems that the documentation of the C core is
> not
> too verbose either. Let me know if you need more information about these
> operators.

That link is quite helpful.

>> 2) I tried to glean out the current state of augmenting attributes to
>> edges when adding them through add_edges() from the mailing list
>> archives, but could not. I understand this is possible when using
>> add_edge(), but it is clear from the authors' replies that add_edges()
>> is much more faster.
> Unfortunately this is not supported directly by add_edges() yet, but you
> can
> create a helper function like:
> def better_add_edges(graph, es, **kwds):
>     m = graph.ecount()
>       graph.add_edges(es)
>       for attr_name, values in kwds.iteritems():
>           graph.es[m:][attr_name] = values
> (If you use igraph from Python 3.x, use kwds.items() instead of
> kwds.iteritems())
> Then you can do something like this:
> better_add_edges(graph, [(2,3), (2,4)], weight=[21,42], color=["red",
> "green"])

Thanks for a very useful snippet.

reply via email to

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