I am roughly new to Networkx in python and I have a question regrading extracting a subgraphs from a huge graph using Networkx. Suppose that we need a subgraph of nodes 6,8,4 from following graph and we have no idea how many intermediate nodes would be there between these 2 nodes but all of the intermediate nodes should be included in the subgraph as well. Thus, we need to extract the subgraph that is showed with green color (In this particular case, the subgraph could be achieved through the path between nodes 8,4, let's think more general and ignore using path between 8 and 4 as a solution). I tried to create a list of nodes and used G.subgraph(list of nodes), but the created subgraph is empty(second figure)! The graph that I work with is a huge directed graph and unfortunately I can't attach its data here. I appreciate if anyone could help me with finding a way to extract green part of the graph. [![enter image description here][1]][1]
[![enter image description here][2]][2]