Edge filter

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Edge filter

Petit Lepton
Dear all, could you tell me what I am doing wrong in the following script, trying to filter an edge?
Best,
F.

bug.py:
import graph_tool as gt
_g = gt.Graph()
_g.add_vertex(2)
_g.add_edge(0,1)
print _g

_p = _g.new_edge_property('int')
for _e in _g.edges() : _p[_e] = 0

_g.set_edge_filter(_p)
print _g


[Flavien@localhost Downloads]$ python bug.py
<Graph object, directed, with 2 vertices and 1 edge at 0x256b990>
Traceback (most recent call last):
  File "bug.py", line 11, in <module>
    print _g
  File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 1272, in __repr__
    n = self.num_vertices()
  File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 2048, in num_vertices
    return self.__graph.GetNumberOfVertices()
RuntimeError: Vertex filter is active but edge filter is not. This is a bug.


_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Edge filter

Petit Lepton
Hi guys, just a quick reminder about this problem which I am facing again.
Best,
F.


On 27 August 2014 14:25, Flavien Lambert <[hidden email]> wrote:
Dear all, could you tell me what I am doing wrong in the following script, trying to filter an edge?
Best,
F.

bug.py:
import graph_tool as gt
_g = gt.Graph()
_g.add_vertex(2)
_g.add_edge(0,1)
print _g

_p = _g.new_edge_property('int')
for _e in _g.edges() : _p[_e] = 0

_g.set_edge_filter(_p)
print _g


[Flavien@localhost Downloads]$ python bug.py
<Graph object, directed, with 2 vertices and 1 edge at 0x256b990>
Traceback (most recent call last):
  File "bug.py", line 11, in <module>
    print _g
  File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 1272, in __repr__
    n = self.num_vertices()
  File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 2048, in num_vertices
    return self.__graph.GetNumberOfVertices()
RuntimeError: Vertex filter is active but edge filter is not. This is a bug.



_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Edge filter

Tiago Peixoto
Administrator
In reply to this post by Petit Lepton
On 27.08.2014 08:25, Flavien Lambert wrote:

> Dear all, could you tell me what I am doing wrong in the following script, trying to filter an edge?
> Best,
> F.
>
> bug.py:
> import graph_tool as gt
> _g = gt.Graph()
> _g.add_vertex(2)
> _g.add_edge(0,1)
> print _g
>
> _p = _g.new_edge_property('int')
> for _e in _g.edges() : _p[_e] = 0
>
> _g.set_edge_filter(_p)
> print _g
>
>
> [Flavien@localhost Downloads]$ python bug.py
> <Graph object, directed, with 2 vertices and 1 edge at 0x256b990>
> Traceback (most recent call last):
>   File "bug.py", line 11, in <module>
>     print _g
>   File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 1272, in __repr__
>     n = self.num_vertices()
>   File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 2048, in num_vertices
>     return self.__graph.GetNumberOfVertices()
> RuntimeError: Vertex filter is active but edge filter is not. This is a bug.

This is clearly a bug; I'll take care of it in the next couple of days
(I'm currently on travel).

Could you please verify if you get the same error with a property map of
type "bool" instead of "int"?

Best,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>
_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: Edge filter

Petit Lepton
Well done! I do not have the bug with a bool property instead of int :
[Flavien@localhost tmp]$ python bug.py
<Graph object, directed, with 2 vertices and 1 edge at 0x191d910>
<Graph object, directed, with 2 vertices and 0 edges, edges filtered by (<PropertyMap object with key type 'Edge' and value type 'bool', for Graph 0x191d910, at 0x191d710>, False), vertices filtered by (<PropertyMap object with key type 'Vertex' and value type 'bool', for Graph 0x191d910, at 0x191d8d0>, False) at 0x191d910>

Have a nice trip,
F.


On 1 September 2014 15:57, Tiago de Paula Peixoto <[hidden email]> wrote:
On <a href="tel:27.08.2014%2008" value="+12708201408">27.08.2014 08:25, Flavien Lambert wrote:
> Dear all, could you tell me what I am doing wrong in the following script, trying to filter an edge?
> Best,
> F.
>
> bug.py:
> import graph_tool as gt
> _g = gt.Graph()
> _g.add_vertex(2)
> _g.add_edge(0,1)
> print _g
>
> _p = _g.new_edge_property('int')
> for _e in _g.edges() : _p[_e] = 0
>
> _g.set_edge_filter(_p)
> print _g
>
>
> [Flavien@localhost Downloads]$ python bug.py
> <Graph object, directed, with 2 vertices and 1 edge at 0x256b990>
> Traceback (most recent call last):
>   File "bug.py", line 11, in <module>
>     print _g
>   File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 1272, in __repr__
>     n = self.num_vertices()
>   File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 2048, in num_vertices
>     return self.__graph.GetNumberOfVertices()
> RuntimeError: Vertex filter is active but edge filter is not. This is a bug.

This is clearly a bug; I'll take care of it in the next couple of days
(I'm currently on travel).

Could you please verify if you get the same error with a property map of
type "bool" instead of "int"?

Best,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>
_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool


_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Edge filter

Tiago Peixoto
Administrator
In reply to this post by Tiago Peixoto
On 01.09.2014 09:57, Tiago de Paula Peixoto wrote:
> This is clearly a bug; I'll take care of it in the next couple of days

This is fixed now in git.

Best,
Tiago


--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (836 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>