Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 13 additions & 25 deletions _nx_arangodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
$ python _nx_arangodb/__init__.py
"""

import networkx as nx

from _nx_arangodb._version import __version__

# This is normally handled by packaging.version.Version, but instead of adding
Expand All @@ -28,14 +30,7 @@
# "description": "TODO",
"functions": {
# BEGIN: functions
"betweenness_centrality",
"is_partition",
"louvain_communities",
"louvain_partitions",
"modularity",
"pagerank",
"shortest_path",
"to_scipy_sparse_array",
# END: functions
},
"additional_docs": {
Expand All @@ -45,27 +40,9 @@
},
"additional_parameters": {
# BEGIN: additional_parameters
"is_partition": {
"dtype : dtype or None, optional": "The data type (np.float32, np.float64, or None) to use for the edge weights in the algorithm. If None, then dtype is determined by the edge values.",
},
"louvain_communities": {
"dtype : dtype or None, optional": "The data type (np.float32, np.float64, or None) to use for the edge weights in the algorithm. If None, then dtype is determined by the edge values.",
},
"louvain_partitions": {
"dtype : dtype or None, optional": "The data type (np.float32, np.float64, or None) to use for the edge weights in the algorithm. If None, then dtype is determined by the edge values.",
},
"modularity": {
"dtype : dtype or None, optional": "The data type (np.float32, np.float64, or None) to use for the edge weights in the algorithm. If None, then dtype is determined by the edge values.",
},
"pagerank": {
"dtype : dtype or None, optional": "The data type (np.float32, np.float64, or None) to use for the edge weights in the algorithm. If None, then dtype is determined by the edge values.",
},
"shortest_path": {
"dtype : dtype or None, optional": "The data type (np.float32, np.float64, or None) to use for the edge weights in the algorithm. If None, then dtype is determined by the edge values.",
},
"to_scipy_sparse_array": {
"dtype : dtype or None, optional": "The data type (np.float32, np.float64, or None) to use for the edge weights in the algorithm. If None, then dtype is determined by the edge values.",
},
# END: additional_parameters
},
}
Expand Down Expand Up @@ -96,6 +73,17 @@ def get_info():

for key in info_keys:
del d[key]

d["default_config"] = {
"host": None,
"username": None,
"password": None,
"db_name": None,
"load_parallelism": None,
"load_batch_size": None,
"pull_graph": True,
}

return d


Expand Down
5 changes: 1 addition & 4 deletions nx_arangodb/algorithms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
from . import centrality, community, link_analysis, shortest_paths
from .centrality import *
from .community import *
from .link_analysis import *
from . import shortest_paths
from .shortest_paths import *
1 change: 0 additions & 1 deletion nx_arangodb/algorithms/centrality/__init__.py

This file was deleted.

51 changes: 0 additions & 51 deletions nx_arangodb/algorithms/centrality/betweenness.py

This file was deleted.

1 change: 0 additions & 1 deletion nx_arangodb/algorithms/community/__init__.py

This file was deleted.

110 changes: 0 additions & 110 deletions nx_arangodb/algorithms/community/louvain.py

This file was deleted.

1 change: 0 additions & 1 deletion nx_arangodb/algorithms/link_analysis/__init__.py

This file was deleted.

77 changes: 0 additions & 77 deletions nx_arangodb/algorithms/link_analysis/pagerank_alg.py

This file was deleted.

4 changes: 2 additions & 2 deletions nx_arangodb/algorithms/shortest_paths/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def shortest_path(
)

if target is None or source is None:
raise ShortestPathError("Both source and target must be specified for now")
raise NotImplementedError("Both source and target must be specified for now")

if method != "dijkstra":
raise ShortestPathError("Only dijkstra method is supported")
raise NotImplementedError("Only dijkstra method is supported")

query = """
FOR vertex IN ANY SHORTEST_PATH @source TO @target GRAPH @graph
Expand Down
21 changes: 17 additions & 4 deletions nx_arangodb/classes/dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,19 @@ def items(self, data: str | None = None, default: Any | None = None) -> Any:
def __fetch_all(self):
self.clear()

node_dict, _, _, _, _ = get_arangodb_graph(
(
node_dict,
*_,
) = get_arangodb_graph(
self.graph,
load_node_dict=True,
load_adj_dict=False,
load_coo=False,
load_all_vertex_attributes=True,
load_all_edge_attributes=False, # not used
is_directed=False, # not used
is_multigraph=False, # not used
load_coo=False,
symmetrize_edges_if_directed=False, # not used
)

for node_id, node_data in node_dict.items():
Expand Down Expand Up @@ -1174,13 +1180,20 @@ def items(self, data: str | None = None, default: Any | None = None) -> Any:
def __fetch_all(self) -> None:
self.clear()

_, adj_dict, _, _, _ = get_arangodb_graph(
(
_,
adj_dict,
*_,
) = get_arangodb_graph(
self.graph,
load_node_dict=False,
load_adj_dict=True,
load_coo=False,
load_all_vertex_attributes=False, # not used
load_all_edge_attributes=True,
is_directed=False, # TODO: Abstract based on Graph type
is_multigraph=False, # TODO: Abstract based on Graph type
load_coo=False,
symmetrize_edges_if_directed=False, # TODO: Abstract based on Graph type
)

for src_node_id, inner_dict in adj_dict.items():
Expand Down
Loading