Last active
October 20, 2022 14:40
-
-
Save ypanagis/ad2f3d6dd3cc5e453e666ee9c5385b72 to your computer and use it in GitHub Desktop.
Gephi gist to delete all nodes with specific attribute (Modularity class)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete some nodes from Gephi graph | |
# run from Gephi scripting console as execfile("/Fullpath/gephi_del.py") or | |
# execfile("C:\\Fullpath\\gephi_del.py") for windows | |
# Delete all nodes from Modularity class 5 | |
subgraph = g.filter(modularity_class == 5) # first filter those out to a new subgraph | |
# Then iterate and delete | |
for v in subgraph.nodes: | |
print v.label # just testing which node is accessed | |
del v | |
# Now it should work! |
You are right it is strange with the method, even though I could print v.label
, del v
has no real effect. I can speculate that ir works on a copy of the nodes...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will not work, as soon you put the functionality inside of a method.
Please include a solution, where 'del' actually is located inside of a method an works well.