Open dschult opened 1 year ago
Putting this here from https://github.com/networkx/networkx/pull/6688/files#issuecomment-1652314158
preserve_all_attrs=True
argument to _dispatch
and convert_from_nx
that is equivalent to preserve_edge_attrs=True, preserve_node_attrs=True, preserve_graph_attrs=True
.Extra point on quotient_graph
- though it's a pattern that could repeat:
The function takes a weight
parameter (since #6814), but this is only used by the function logic if another parameter, edge_data
is None
. Therefore there is efficiency lost in keeping the weight
attribute if edge_data != None
. This also applies to the open PR #6557.
PR #6688 required going through a lot of our code base and finding out which input arguments were treated how. In that PR, many comments were created and attached to various parts of our codebase. This Issue attempts to collect the comments that didn't lead to an immediate solution or answer. The idea is to check them off when we either resolve them or decide not to resolve them. If I've missed something please add it in the comments and I'll try to put it on the list via editing.
Timing impact
G=nx.path_graph(5); %timeit nx.shortest_path(0,3)
G=nx.path_graph(50);%timeit nx.shortest_path(G, 0, 47)
Change to new git branch, then
python -X importtime -c "import networkx"
API warts:
edge_data
which is a valuegraph
which is expected to be a dict.graph_name
to be specified inLoopbackDispatcher.convert_from_nx
helped a lot with debugging for this PRLoopbackDispatcher.convert_from_nx
has a list of function names for which converting the graph doesn't happen. We can add to that list if needed (escape hatch for debugging).to_numpy_array
specially for dtype argument.flow.py
private; like:preflow_push_impl
test_christofides_hamiltonian
.)git grep -A 2 '_dispatch.*preserve_edge_attrs={"G":'
Misc notes:
edge_attrs={"weight": None}
Questions:
Q: how to handle create_using inputs when dispatching?
For the future, perhaps we should:
min
,sum
, etc.networkx/drawing/layout.py
algorithms.