Более чистая версия @ zohar.kom будет использовать метод подграфа:
import networkx as nx
import matplotlib.pyplot as plt
graph = nx.random_graphs.watts_strogatz_graph(100, 3, .4)
threshold = 2
sub = graph.subgraph([node for node in graph.nodes() if \
graph.degree(node) != threshold])
fig, ax = plt.subplots(2, 1)
nx.draw(graph, ax = ax[0], with_labels = 1)
nx.draw(sub, ax = ax[1], with_labels = 1)
![enter image description here](https://i.stack.imgur.com/zjOKd.png)