total_neighbors

Generic Description

Counts the union size of two list-as-set inputs. It is documented separately because similarity orientation, vector dimensions, and set semantics directly affect ranking and interpretation.

Simple example:

RETURN total_neighbors(['a', 'b'], ['b', 'c']) AS value

Consumer-Level Explanation

Use it as the denominator context for overlap-style comparisons. Prefer this function when symbolic graph filters and similarity evidence should remain in one auditable Cypher pipeline.

More Detailed Explanation

total_neighbors keeps similarity scoring in the same Cypher pipeline as symbolic graph filters and document metadata checks. That lets a query combine labels, relationships, time filters, and embedding or set overlap scores without asking a client to reconcile separate result sets.

Advanced Example

This example applies total_neighbors after symbolic graph filtering, which keeps hybrid retrieval constraints and similarity scoring in one visible pipeline.

MATCH (d:Document)
WITH d, keys(properties(d.metadata)) AS metadata_keys
RETURN d.title AS document,
       total_neighbors(metadata_keys, ['kind', 'lang', 'owner']) AS compared_metadata_fields
ORDER BY compared_metadata_fields DESC

Real Use Cases

Real Limitations And Tradeoffs