Hi Guys! What is the best way to remove vertices that do not have any edges? Best, Alex
Hi Ales, personally I would use a filter, exploiting the methods in_degree() and out_degree(). I.e. something like gv = GraphView(g,vfilt=lambda x: x.in_degree()+x.out_degree()>0) If your graph is undirected, you can use only out_degree(). I strongly advise you to read the documentation, there i splenty of information there. Best, Giuseppe 2017-03-20 14:08 GMT+01:00 Hobé Alex <ahobe@student.ethz.ch>:
Hi Guys!
What is the best way to remove vertices that do not have any edges?
Best,
Alex
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
Hi Giuseppe Thanks for the help. Best, Alex ________________________________ From: graph-tool [graph-tool-bounces@skewed.de] on behalf of Giuseppe Profiti [gamma2@users.sourceforge.net] Sent: Monday, March 20, 2017 14:19 To: Main discussion list for the graph-tool project Subject: Re: [graph-tool] Remove vertices without edges Hi Ales, personally I would use a filter, exploiting the methods in_degree() and out_degree(). I.e. something like gv = GraphView(g,vfilt=lambda x: x.in_degree()+x.out_degree()>0) If your graph is undirected, you can use only out_degree(). I strongly advise you to read the documentation, there i splenty of information there. Best, Giuseppe 2017-03-20 14:08 GMT+01:00 Hobé Alex <ahobe@student.ethz.ch<mailto:ahobe@student.ethz.ch>>: Hi Guys! What is the best way to remove vertices that do not have any edges? Best, Alex _______________________________________________ graph-tool mailing list graph-tool@skewed.de<mailto:graph-tool@skewed.de> https://lists.skewed.de/mailman/listinfo/graph-tool
participants (2)
-
Giuseppe Profiti -
Hobé Alex