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

Unify tests for digraph and multidigraph #43

Merged
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
6 changes: 4 additions & 2 deletions grandcypher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _is_edge_attr_match(
continue
if host_edges.get(attr) != val:
return False

return True


Expand All @@ -260,7 +260,6 @@ def _aggregate_edge_labels(edges: Dict) -> Dict:
aggregated[edge_id] = attrs
return aggregated


def _get_entity_from_host(
host: Union[nx.DiGraph, nx.MultiDiGraph], entity_name, entity_attribute=None
):
Expand Down Expand Up @@ -330,6 +329,7 @@ def inner(
if isinstance(host, nx.MultiDiGraph):
# if any of the relations between nodes satisfies condition, return True
r_vals = _get_entity_from_host(host, *host_entity_id)
r_vals = [r_vals] if not isinstance(r_vals, list) else r_vals
val = any(operator(r_val, value) for r_val in r_vals)
else:
val = operator(_get_entity_from_host(host, *host_entity_id), value)
Expand Down Expand Up @@ -485,6 +485,7 @@ def _lookup(self, data_paths: List[str], offset_limit) -> Dict[str, List]:

result[data_path] = list(ret)[offset_limit]


return result

def return_clause(self, clause):
Expand Down Expand Up @@ -726,6 +727,7 @@ def _edge_hop_motifs(self, motif: nx.MultiDiGraph) -> List[Tuple[nx.Graph, dict]
if motif.out_degree(n) == 0 and motif.in_degree(n) == 0:
new_motif.add_node(n, **motif.nodes[n])
motifs: List[Tuple[nx.DiGraph, dict]] = [(new_motif, {})]

for u, v, k in motif.edges: # OutMultiEdgeView([('a', 'b', 0)])
new_motifs = []
min_hop = motif.edges[u, v, k]["__min_hop__"]
Expand Down
Loading
Loading