I'm trying to plot a networkx graph on Python. Instead of plotting all nodes and edges, I'd like to filter out nodes which has link to a user given node. I think this is similar to subcomponent in iGraph in R. For example, in the below code, my dataframe has a node 4429. I'd like to plot nodes and edges that are connected directly or indirectly to 4429.
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import pylab
G = nx.DiGraph()
g = nx.from_pandas_edgelist(dataframe, 'Source', 'Target', ['Freq'])
nx.draw_networkx(g)
plt.xticks([], [])
plt.yticks([], [])
fig = plt.gcf()
fig.set_size_inches(15, 15)
plt.show()
Any help would be appreciated. Thanks.