On 07.12.2016 23:08, bloodymeli wrote:
B) When I set the directedness flag to 1, am I guaranteed that every undirected edge would be converted to two directed edges?
Not at all. The set_directed() function does nothing more than to set a flag indicating the directness, it does not modify the graph in any other way. It is supposed to be an efficient O(1) operation. In particular, the number of edges is exactly the same after the function is called.
If not, how can I perform this operation (A = A + A', assuming the adjacency matrix is triangular) or validate it?
If you want to make the graph bidirectional, you have to iterate through all the edges and add an opposing one for each: edges = list(g.edges()) for e in edges: g.add_edge(e.target(), e.source()) -- Tiago de Paula Peixoto <tiago@skewed.de>