Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement .generators.ego.ego_graph #61

Merged
merged 3 commits into from
May 3, 2023

Conversation

eriknw
Copy link
Member

@eriknw eriknw commented Apr 29, 2023

Also, clean up shared BFS functions and move to _bfs.py.

Don't be alarmed if there's a failing test. I think we need to make a small change upstream to networkx to handle a weight argument that uses the keyword distance=.

Also, clean up shared BFS functions and move to `_bfs.py`.
@eriknw
Copy link
Member Author

eriknw commented May 1, 2023

fyi, this PR also added tests that show what functions have and have not been implemented. For example:

$ pytest -s -k test_print_dispatched_not_implemented

graphblas_algorithms/tests/test_match_nx.py
=================================================================================
Functions dispatched in NetworkX that ARE NOT implemented in graphblas-algorithms
---------------------------------------------------------------------------------
0 networkx.algorithms.bipartite.basic.is_bipartite
1 networkx.algorithms.centrality.betweenness.betweenness_centrality
2 networkx.algorithms.centrality.betweenness.edge_betweenness_centrality
3 networkx.algorithms.components.connected.connected_components
4 networkx.algorithms.components.strongly_connected.strongly_connected_components
5 networkx.algorithms.components.weakly_connected.weakly_connected_components
6 networkx.algorithms.core.core_number
7 networkx.algorithms.core.k_core
8 networkx.algorithms.link_prediction.jaccard_coefficient
9 networkx.algorithms.shortest_paths.generic.shortest_path
10 networkx.algorithms.shortest_paths.generic.shortest_path_length
11 networkx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path
12 networkx.algorithms.shortest_paths.unweighted.single_source_shortest_path
13 networkx.algorithms.shortest_paths.unweighted.single_target_shortest_path
14 networkx.algorithms.shortest_paths.weighted.all_pairs_bellman_ford_path
15 networkx.algorithms.shortest_paths.weighted.bellman_ford_path
16 networkx.algorithms.shortest_paths.weighted.bellman_ford_path_length
17 networkx.algorithms.shortest_paths.weighted.bellman_ford_predecessor_and_distance
18 networkx.algorithms.shortest_paths.weighted.single_source_bellman_ford
19 networkx.algorithms.shortest_paths.weighted.single_source_bellman_ford_path
20 networkx.algorithms.traversal.breadth_first_search.bfs_edges
21 networkx.algorithms.traversal.breadth_first_search.bfs_predecessors
22 networkx.algorithms.traversal.breadth_first_search.bfs_successors
23 networkx.algorithms.traversal.edgebfs.edge_bfs
=================================================================================

and

$ pytest -s -k test_print_dispatched_implemented

graphblas_algorithms/tests/test_match_nx.py
=============================================================================
Functions dispatched in NetworkX that ARE implemented in graphblas-algorithms
-----------------------------------------------------------------------------
0 networkx.algorithms.boundary.edge_boundary
1 networkx.algorithms.boundary.node_boundary
2 networkx.algorithms.centrality.degree_alg.degree_centrality
3 networkx.algorithms.centrality.degree_alg.in_degree_centrality
4 networkx.algorithms.centrality.degree_alg.out_degree_centrality
5 networkx.algorithms.centrality.eigenvector.eigenvector_centrality
6 networkx.algorithms.centrality.katz.katz_centrality
7 networkx.algorithms.cluster.average_clustering
8 networkx.algorithms.cluster.clustering
9 networkx.algorithms.cluster.generalized_degree
10 networkx.algorithms.cluster.square_clustering
11 networkx.algorithms.cluster.transitivity
12 networkx.algorithms.cluster.triangles
13 networkx.algorithms.community.quality.inter_community_edges
14 networkx.algorithms.community.quality.intra_community_edges
15 networkx.algorithms.components.connected.is_connected
16 networkx.algorithms.components.connected.node_connected_component
17 networkx.algorithms.components.weakly_connected.is_weakly_connected
18 networkx.algorithms.core.k_truss
19 networkx.algorithms.cuts.boundary_expansion
20 networkx.algorithms.cuts.conductance
21 networkx.algorithms.cuts.cut_size
22 networkx.algorithms.cuts.edge_expansion
23 networkx.algorithms.cuts.mixing_expansion
24 networkx.algorithms.cuts.node_expansion
25 networkx.algorithms.cuts.normalized_cut_size
26 networkx.algorithms.cuts.volume
27 networkx.algorithms.dag.ancestors
28 networkx.algorithms.dag.descendants
29 networkx.algorithms.dominating.is_dominating_set
30 networkx.algorithms.isolate.is_isolate
31 networkx.algorithms.isolate.isolates
32 networkx.algorithms.isolate.number_of_isolates
33 networkx.algorithms.link_analysis.hits_alg.hits
34 networkx.algorithms.link_analysis.pagerank_alg.google_matrix
35 networkx.algorithms.link_analysis.pagerank_alg.pagerank
36 networkx.algorithms.operators.binary.compose
37 networkx.algorithms.operators.binary.difference
38 networkx.algorithms.operators.binary.disjoint_union
39 networkx.algorithms.operators.binary.full_join
40 networkx.algorithms.operators.binary.intersection
41 networkx.algorithms.operators.binary.symmetric_difference
42 networkx.algorithms.operators.binary.union
43 networkx.algorithms.reciprocity.overall_reciprocity
44 networkx.algorithms.reciprocity.reciprocity
45 networkx.algorithms.regular.is_k_regular
46 networkx.algorithms.regular.is_regular
47 networkx.algorithms.shortest_paths.dense.floyd_warshall
48 networkx.algorithms.shortest_paths.dense.floyd_warshall_numpy
49 networkx.algorithms.shortest_paths.dense.floyd_warshall_predecessor_and_distance
50 networkx.algorithms.shortest_paths.generic.has_path
51 networkx.algorithms.shortest_paths.unweighted.all_pairs_shortest_path_length
52 networkx.algorithms.shortest_paths.unweighted.single_source_shortest_path_length
53 networkx.algorithms.shortest_paths.unweighted.single_target_shortest_path_length
54 networkx.algorithms.shortest_paths.weighted.all_pairs_bellman_ford_path_length
55 networkx.algorithms.shortest_paths.weighted.negative_edge_cycle
56 networkx.algorithms.shortest_paths.weighted.single_source_bellman_ford_path_length
57 networkx.algorithms.simple_paths.is_simple_path
58 networkx.algorithms.smetric.s_metric
59 networkx.algorithms.structuralholes.mutual_weight
60 networkx.algorithms.tournament.is_tournament
61 networkx.algorithms.tournament.score_sequence
62 networkx.algorithms.tournament.tournament_matrix
63 networkx.algorithms.traversal.breadth_first_search.bfs_layers
64 networkx.algorithms.traversal.breadth_first_search.descendants_at_distance
65 networkx.algorithms.triads.is_triad
66 networkx.generators.ego.ego_graph
=============================================================================

You can see we're making some progress!

eriknw added 2 commits May 3, 2023 11:39
Support and test against Python 3.11
Change devlepment status to Beta (was Alpha).
@eriknw eriknw merged commit 3cc4180 into python-graphblas:main May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant