Deleting nodes with tie=1 in a large NetworkX graph
问题 I have made large graph with NetworkX with about 20,000 nodes. I would like to delete nodes with only one tie (or zero ties) to try to reduce the clutter. Since it is a very large graph I do not know the nodes by name or ID that have tie=1 or 0. Does anyone know how to delete these nodes without specifying the node ID or name? 回答1: Iterating on a Graph g yields all of g 's nodes, one at a time -- I believe you can't alter g during the iteration itself, but you can selectively make a list of