Skip to content

Commit

Permalink
Merge pull request #26 from Bears-R-Us/code-module-overhaul
Browse files Browse the repository at this point in the history
updated code modules, tests, and documentation
  • Loading branch information
alvaradoo authored Apr 30, 2023
2 parents cd0427c + 7503af0 commit 5ddbb54
Show file tree
Hide file tree
Showing 24 changed files with 1,671 additions and 1,295 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added arachne/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion arachne/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ python3 bfs.py node port -d /path/to/arkouda-njit/arachne/data -t 10
## Testing
The Arachne tests are executed from the arkouda-njit/arachne directory as follows:
```
python3 -m pytest test/bfs_test.py test/reading_test.py test/class_test.py
python3 -m pytest test/algorithm_test.py test/class_test.py test/prop_graph_test.py test/reading_test.py
```
**Note**: Errors when executing using pytest from arachne directory.
6 changes: 3 additions & 3 deletions arachne/arachne_simple_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create_parser():
src = ak.array([34, 23, 34, 23, 23, 89])
dst = ak.array([23, 34, 89, 89, 89, 89])
wgt = ak.array([98, 12, 13, .4, 23, 12])
graph = ar.DiGraph()
graph = ar.PropGraph()
graph.add_edges_from(src, dst, wgt)

# Add node labels to the property graph.
Expand Down Expand Up @@ -102,8 +102,8 @@ def create_parser():
print("Edges with property since from 2011 =\n", edge_property_filter.__repr__())
print()

H = ar.subgraph_view(graph, filter_labels=node_label_filter, filter_relationships=edge_relationship_filter, filter_node_properties=node_property_filter, filter_edge_properties=edge_property_filter)
subgraph = ar.subgraph_view(graph, ar.Graph(), filter_labels=node_label_filter, filter_relationships=edge_relationship_filter, filter_node_properties=node_property_filter, filter_edge_properties=edge_property_filter)
print(graph.edges())
print(H.edges())
print(subgraph.edges())

ak.shutdown()
4 changes: 3 additions & 1 deletion arachne/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ Due to the emergence of massive real-world graphs such as social networks, compu
- Graph Double-Index Data Structuren Class(es) and Methods
- `Graph` class for undirected (un)weighted graphs.
- `DiGraph` class for directed weighted graphs.
- `PropGraph` class for property graphs that can hold node labels, edge relationships, and properties for both nodes and edges.
- `__len__(self) -> int` returns the number of vertices of a Graph (DiGraph) G. Use `len(G)`.
- `size(self) -> int` returns the number of edges of a Graph (DiGraph) G. Use `G.size()`.
- `add_edges_from(self, akarray_src: pdarray, akarray_dst: pdarray, akarray_weight: Union[None, pdarray] = None) -> None` adds to a Graph (DiGraph) object edges from arkouda arrays. The arrays `akarray_src` and `akarray_dst` must be specificed. An optional extra array called `akarray_weight` could be used to make a weighted Graph (DiGraph).
- **More found in arachne.py**
- Graph Building Methods
- `read_edgelist(path: str, weighted: bool = False, directed: bool = False, comments: str = "#", filetype: str = "txt") -> Union[Graph, DiGraph]` returns a Graph or DiGraph object with read graph data. Removes self-loops and multiedges. Has option to enable reading in a matrix market file that is typically used to store graphs.
- `read_known_edgelist(ne: int, nv: int, path: str, weighted: bool = False, directed: bool = False, comments: str = "#", filetype: str = "txt") -> Union[Graph, DiGraph]` returns a Graph or DiGraph object with read graph data. Does not remove self-loops or multiedges. Intended for use when the number of vertices or edges are known for faster graph building times.
- Algorithms
- `bfs_layers(graph: Graph, source: int) -> pdarray` returns a depth array with how far each vertex is from the source vertex. Currently, we only support single source BFS.
- **More to Come!**
- **More found in arachne.py**
Loading

0 comments on commit 5ddbb54

Please sign in to comment.