I am using python with networkx package. I need to find the nodes connected to the edges of the given node. I know that there is a networkx.DiGraph.out_edges function, but it returns edges for the entire graph.
I am not an expert on the network, but have you tried networkx.DiGraph.out_edges by specifying the source of the node?
DiGraph.out_edges(nbunch=None, data=False) Returns a list of edges.The edges are returned in the form of tuples with additional data in order (node, neighbor, data).
DiGraph.out_edges(nbunch=None, data=False)
Returns a list of edges.
The edges are returned in the form of tuples with additional data in order (node, neighbor, data).
If you just want to cut the edges for one node, skip the node inside nbunch:
graph.out_edges([my_node])
The easiest way is to use the successors () method:
In [1]: import networkx as nx In [2]: G=nx.DiGraph([(0,1),(1,2)]) In [3]: G.edges() Out[3]: [(0, 1), (1, 2)] In [4]: G.successors(1) Out[4]: [2]
Source: https://habr.com/ru/post/1731188/More articles:An iterator for a custom container with derived classes - c ++Are absolute file paths allowed in mod_rewrite? - apacheC ++ - passing a std :: ostream function to a function - c ++mod_rewrite - абсолютный путь в .htaccess - включение 404 - apacheJQuery Validation Plugin: Use Ajax Custom Method - jqueryhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1731189/using-iterators-to-hide-internal-container-and-achieve-generic-operation-over-a-base-container&usg=ALkJrhg7BlutmTEKClMadUPksPfWVdA2wAWhat is wrong with this mod_rewrite expression? - apachefocus in a text box - javascriptWhat is the correct column type for storing URLs in MySQL? - mysqlIs there a rule for detecting errors in Lex / Yacc analysis? - cAll Articles