igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] python-igraph: Get graph from edge


From: Tamás Nepusz
Subject: Re: [igraph] python-igraph: Get graph from edge
Date: Thu, 20 Jun 2013 23:40:46 +0200

For the record: I have just committed a patch that adds the missing "graph" 
attribute to Edge and Vertex objects in the Python interface.

-- 
T.

On 19 Jun 2013, at 23:04, Tamás Nepusz <address@hidden> wrote:

> Indeed, python-igraph keeps track of the graph the edge belongs to, but this 
> is not exposed via an attribute yet -- to be honest, I have no idea why, 
> probably simply because I forgot to include it. The EdgeSeq itself (e.g., 
> g.es) has a "graph" attribute that you can use to get back to the graph. I 
> will make sure that the same attribute is added to Edge and Vertex objects in 
> the next release.
> 
> -- 
> T.
> 
> On 19 Jun 2013, at 22:23, Bradford Boyle <address@hidden> wrote:
> 
>> Using python-igraph, is it possible to, given an edge, get the graph that 
>> the edge is contained in? Suppose that I have a graph G, executing 
>> `print(g.__repr__())` returns:
>> 
>>    <igraph.Graph object at 0x7ff56ecbf810>
>> 
>> whereas `print(g.es[0].__repr__())` returns:
>> 
>>    <igraph.Edge(<igraph.Graph object at 0x7ff56ecbf810>, 0, {})>
>> 
>> This would suggest to me that internally, igraph is keeping track of which 
>> graph object an edge belongs to. The motivation for my question is that 
>> given only an edge, I cannot get attributes from the source or target 
>> vertices. To access the vertex attributes, I would need both the graph and 
>> the edge. If the graph could be gotten from the edge, then edge be 
>> sufficient.
>> 
>> Bradford
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
> 




reply via email to

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