Skip to content

unionfind zero edge hop (#89)#92

Closed
khoale88 wants to merge 1 commit intoaplbrain:masterfrom
khoale88:issue-89
Closed

unionfind zero edge hop (#89)#92
khoale88 wants to merge 1 commit intoaplbrain:masterfrom
khoale88:issue-89

Conversation

@khoale88
Copy link
Contributor

No description provided.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 14, 2025

CodSpeed Performance Report

Merging #92 will not alter performance

Comparing khoale88:issue-89 (7fbff22) with master (e9dcd88)

Summary

✅ 97 untouched
🆕 2 new

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 test_node_type_edge_zero_hop_complex[DiGraph] N/A 58.9 ms N/A
🆕 test_node_type_edge_zero_hop_complex[MultiDiGraph] N/A 59.2 ms N/A

@khoale88
Copy link
Contributor Author

Hi @j6k4m8 , this is a fix for #89 . We now collapse all zero edge hope nodes together, and redirect related non-zero hop edges with them. I use union find to do this.

one test case break though, and I think it break correctly

        host = graph_type()
        host.add_node("x", __labels__=set(["Node", "X"]), foo="1")
        host.add_node("y", __labels__=set(["Node", "Y"]), foo="2")
        host.add_node("z", __labels__=set(["Node", "Z"]), foo="3")
        host.add_edge("x", "y")
        host.add_edge("y", "z")

       
        qry = """
        MATCH (A:X)-[*0..2]->(B)
        where B.foo == "1" or B.foo == "3"
        RETURN ID(A), ID(B)
        """

        res = GrandCypher(host).run(qry)
        assert len(res) == 2
        assert res["ID(A)"] == ["x", "z", "x"]  # <<<< we have z to z now
        assert res["ID(B)"] == ["x", "z", "z"]

@khoale88 khoale88 mentioned this pull request Nov 30, 2025
@khoale88 khoale88 closed this Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant