-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
159 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
def get_info(): | ||
return { | ||
"backend_name": "graphblas", | ||
"project": "graphblas-algorithms", | ||
"package": "graphblas_algorithms", | ||
"url": "https://github.com/python-graphblas/graphblas-algorithms", | ||
"short_summary": "Fast, OpenMP-enabled backend using GraphBLAS", | ||
# "description": "TODO", | ||
"functions": { | ||
"adjacency_matrix": {}, | ||
"all_pairs_bellman_ford_path_length": { | ||
"extra_parameters": { | ||
"chunksize": "Split the computation into chunks; " | ||
'may specify size as string or number of rows. Default "10 MiB"', | ||
}, | ||
}, | ||
"all_pairs_shortest_path_length": { | ||
"extra_parameters": { | ||
"chunksize": "Split the computation into chunks; " | ||
'may specify size as string or number of rows. Default "10 MiB"', | ||
}, | ||
}, | ||
"ancestors": {}, | ||
"average_clustering": {}, | ||
"bellman_ford_path": {}, | ||
"bellman_ford_path_length": {}, | ||
"bethe_hessian_matrix": {}, | ||
"bfs_layers": {}, | ||
"boundary_expansion": {}, | ||
"clustering": {}, | ||
"complement": {}, | ||
"compose": {}, | ||
"conductance": {}, | ||
"cut_size": {}, | ||
"degree_centrality": {}, | ||
"descendants": {}, | ||
"descendants_at_distance": {}, | ||
"difference": {}, | ||
"directed_modularity_matrix": {}, | ||
"disjoint_union": {}, | ||
"edge_boundary": {}, | ||
"edge_expansion": {}, | ||
"efficiency": {}, | ||
"ego_graph": {}, | ||
"eigenvector_centrality": {}, | ||
"fast_could_be_isomorphic": {}, | ||
"faster_could_be_isomorphic": {}, | ||
"floyd_warshall": {}, | ||
"floyd_warshall_numpy": {}, | ||
"floyd_warshall_predecessor_and_distance": {}, | ||
"full_join": {}, | ||
"generalized_degree": {}, | ||
"google_matrix": {}, | ||
"has_path": {}, | ||
"hits": {}, | ||
"in_degree_centrality": {}, | ||
"inter_community_edges": {}, | ||
"intersection": {}, | ||
"intra_community_edges": {}, | ||
"is_connected": {}, | ||
"is_dominating_set": {}, | ||
"is_isolate": {}, | ||
"is_k_regular": {}, | ||
"isolates": {}, | ||
"is_regular": {}, | ||
"is_simple_path": {}, | ||
"is_tournament": {}, | ||
"is_triad": {}, | ||
"is_weakly_connected": {}, | ||
"katz_centrality": {}, | ||
"k_truss": {}, | ||
"laplacian_matrix": {}, | ||
"lowest_common_ancestor": {}, | ||
"mixing_expansion": {}, | ||
"modularity_matrix": {}, | ||
"mutual_weight": {}, | ||
"negative_edge_cycle": {}, | ||
"node_boundary": {}, | ||
"node_connected_component": {}, | ||
"node_expansion": {}, | ||
"normalized_cut_size": {}, | ||
"normalized_laplacian_matrix": {}, | ||
"number_of_isolates": {}, | ||
"out_degree_centrality": {}, | ||
"overall_reciprocity": {}, | ||
"pagerank": {}, | ||
"reciprocity": {}, | ||
"reverse": {}, | ||
"score_sequence": {}, | ||
"single_source_bellman_ford_path_length": {}, | ||
"single_source_shortest_path_length": {}, | ||
"single_target_shortest_path_length": {}, | ||
"s_metric": {}, | ||
"square_clustering": { | ||
"extra_parameters": { | ||
"chunksize": "Split the computation into chunks; " | ||
'may specify size as string or number of rows. Default "256 MiB"', | ||
}, | ||
}, | ||
"symmetric_difference": {}, | ||
"tournament_matrix": {}, | ||
"transitivity": {}, | ||
"triangles": {}, | ||
"union": {}, | ||
"volume": {}, | ||
}, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import warnings | ||
|
||
from graphblas_algorithms import algorithms | ||
from graphblas_algorithms.classes.digraph import to_graph | ||
|
||
from .exception import NetworkXError | ||
|
||
__all__ = ["s_metric"] | ||
|
||
|
||
def s_metric(G, normalized=True): | ||
if normalized: | ||
raise NetworkXError("Normalization not implemented") | ||
def s_metric(G, **kwargs): | ||
if kwargs: | ||
if "normalized" in kwargs: | ||
warnings.warn( | ||
"\n\nThe `normalized` keyword is deprecated and will be removed\n" | ||
"in the future. To silence this warning, remove `normalized`\n" | ||
"when calling `s_metric`.\n\nThe value of `normalized` is ignored.", | ||
DeprecationWarning, | ||
stacklevel=2, | ||
) | ||
else: | ||
raise TypeError(f"s_metric got an unexpected keyword argument '{kwargs.popitem()[0]}'") | ||
G = to_graph(G) | ||
return algorithms.s_metric(G) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ name = "graphblas-algorithms" | |
dynamic = ["version"] | ||
description = "Graph algorithms written in GraphBLAS and backend for NetworkX" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
requires-python = ">=3.9" | ||
license = {file = "LICENSE"} | ||
authors = [ | ||
{name = "Erik Welch", email = "[email protected]"}, | ||
|
@@ -43,7 +43,6 @@ classifiers = [ | |
"Operating System :: Microsoft :: Windows", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
|
@@ -65,6 +64,12 @@ dependencies = [ | |
[project.entry-points."networkx.plugins"] | ||
graphblas = "graphblas_algorithms.interface:Dispatcher" | ||
|
||
[project.entry-points."networkx.backends"] | ||
graphblas = "graphblas_algorithms.interface:Dispatcher" | ||
|
||
[project.entry-points."networkx.backend_info"] | ||
graphblas = "_nx_graphblas:get_info" | ||
|
||
[project.urls] | ||
homepage = "https://github.com/python-graphblas/graphblas-algorithms" | ||
# documentation = "https://graphblas-algorithms.readthedocs.io" | ||
|
@@ -90,6 +95,7 @@ all = [ | |
# $ find graphblas_algorithms/ -name __init__.py -print | sort | sed -e 's/\/__init__.py//g' -e 's/\//./g' | ||
# $ python -c 'import tomli ; [print(x) for x in sorted(tomli.load(open("pyproject.toml", "rb"))["tool"]["setuptools"]["packages"])]' | ||
packages = [ | ||
"_nx_graphblas", | ||
"graphblas_algorithms", | ||
"graphblas_algorithms.algorithms", | ||
"graphblas_algorithms.algorithms.centrality", | ||
|
@@ -127,7 +133,7 @@ dirty_template = "{tag}+{ccount}.g{sha}.dirty" | |
|
||
[tool.black] | ||
line-length = 100 | ||
target-version = ["py38", "py39", "py310", "py311"] | ||
target-version = ["py39", "py310", "py311"] | ||
|
||
[tool.isort] | ||
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] | ||
|
@@ -143,6 +149,7 @@ skip = [ | |
] | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
testpaths = "graphblas_algorithms" | ||
xfail_strict = false | ||
markers = [ | ||
|
@@ -169,7 +176,10 @@ exclude_lines = [ | |
[tool.ruff] | ||
# https://github.com/charliermarsh/ruff/ | ||
line-length = 100 | ||
target-version = "py38" | ||
target-version = "py39" | ||
unfixable = [ | ||
"F841" # unused-variable (Note: can leave useless expression) | ||
] | ||
select = [ | ||
"ALL", | ||
] | ||
|