-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make weight_fn optional in adjacency matrix and fw numpy (#158)
* Make weight_fn optional adjacency matrix fw numpy This commit makes the weight_fn argument for graph_adjacency_matrix, digraph_adjacency_matrix, graph_floyd_warshall_numpy, and digraph_floyd_warshall_numpy optional. A new kwarg is added default_weight (which defaults to 1.0) which can be used instead of passing a callable. If weight_fn is not set the value of default_weight will be used for all edges. Previously, a function returning a fixed value would have to be used to accomplish this. In practice there was not much overhead to just using something like 'lambda _: 1' as the weight fn, but it was a bit of a clumsy interface. * Add tests * Fix rebase issue * Add test coverage for floyd warshall too * Fix text_signature for weight_fn
- Loading branch information
Showing
3 changed files
with
146 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters