The basic usage in the Graph-tool: how to delete vertex and related edges in the Graph-tool?
Hi All, I am new to Graph-tool and learning the basic operation on the Graph. The below command confused me a lot. --------------------------------------------- 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.
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>
--------------------------------------------- I know the clear_vertex is to clear all edges related with the Vertex. But after executing the clear_vertex, it seems that the Graph still contains 1 edge created before. Will I need to revise my code ? I post the same on the stackoverflow https://stackoverflow.com/questions/45031315/the-basic-usage-in-the-graph-to... Thank you, Best Regards. -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 11.07.2017 16:00, zhfkt wrote:
I know the clear_vertex is to clear all edges related with the Vertex. But after executing the clear_vertex, it seems that the Graph still contains 1 edge created before. Will I need to revise my code ?
This is a simple bug hat has already been fixed in git. The edges are actually deleted from the graph, but the counter is not updated. You can check by doing: len(list(g.edges())) The fix will be available in the next version, but in the meantime you can just ignore it, or install from git.
I post the same on the stackoverflow https://stackoverflow.com/questions/45031315/the-basic-usage-in-the-graph-to...
It is redundant to post in stack overflow; the proper places are this mailing list and the issue tracker in the website. -- Tiago de Paula Peixoto <tiago@skewed.de>
Thank you for quick clarification. I can have a good sleep tonight. -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
participants (2)
-
Tiago de Paula Peixoto -
zhfkt