Graph-tool中的基本用法:如何删除Graph-tool中的顶点和相关边?

The basic usage in the Graph-tool: how to delete vertex and related edges in the Graph-tool?

我是Graph-tool新手,正在学习Graph的基本操作。下面的命令让我很困惑。

Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> G=Graph(directed=False)
>>> from graph_tool.all import *                                                                                                                                                                                                            
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
>>> G=Graph(directed=False)                                                                                                                                                                                                                 
>>> G.add_vertex()                                                                                                                                                                                                                          
<Vertex object with index '0' at 0x7f70714a00f0>
>>> G.add_vertex()
<Vertex object with index '1' at 0x7f70714a0210>
>>> G.add_vertex()
<Vertex object with index '2' at 0x7f70714a00f0>
>>> G.add_vertex()
<Vertex object with index '3' at 0x7f70714a0210>
>>> G.add_vertex()
<Vertex object with index '4' at 0x7f70714a00f0>
>>> G.add_vertex()
<Vertex object with index '5' at 0x7f70714a0210>
>>> G.add_vertex()
<Vertex object with index '6' at 0x7f70714a00f0>
>>> G.add_edge(1,2)                                                                                                                                                                                                                         
<Edge object with source '1' and target '2' at 0x7f7085fca9d0>
>>> print(G)
<Graph object, undirected, with 7 vertices and 1 edge at 0x7f70967c5400>
>>> G.clear_vertex(1)                                                                                                                                                                                                                       
>>> print(G)                                                                                                                                                                                                                                
<Graph object, undirected, with 7 vertices and 1 edge at 0x7f70967c5400>
>>> G.clear_vertex(2)                                                                                                                                                                                                                       
>>> print(G)                                                                                                                                                                                                                                
<Graph object, undirected, with 7 vertices and 1 edge at 0x7f70967c5400>

我知道clear_vertex是清除与顶点相关的所有边。但是在执行了clear_vertex之后,Graph似乎仍然包含之前创建的1条边。我需要修改我的代码吗?

谢谢

这确实是一个错误,但我已经在 git 前一段时间修复了:

https://git.skewed.de/count0/graph-tool/commit/12fea4983ab98eae410a446f27ae5c0dd34cd90c

这个错误基本上是无害的,因为它只是在清除顶点时无法更新边数。边缘实际上被删除了。