Convert my graph representation to a networkx graph
(G)
| 239 | |
| 240 | |
| 241 | def to_networkx(G): |
| 242 | """Convert my graph representation to a networkx graph""" |
| 243 | G_nx = nx.DiGraph() if G.is_directed else nx.Graph() |
| 244 | V = list(G._V2I.keys()) |
| 245 | G_nx.add_nodes_from(V) |
| 246 | |
| 247 | for v in V: |
| 248 | fr_i = G._V2I[v] |
| 249 | edges = G._G[fr_i] |
| 250 | |
| 251 | for edge in edges: |
| 252 | G_nx.add_edge(edge.fr, edge.to, weight=edge._w) |
| 253 | return G_nx |
| 254 | |
| 255 | |
| 256 | def test_all_paths(N=1): |
no outgoing calls
no test coverage detected