Skip to content

Question on the implementation of intersect #136

@ionchirica

Description

@ionchirica

Dear OCamlGraph developers,

This is not really an issue, but rather a question about implementation choices.

Together with @mariojppereira, we have an ongoing project of formally verifying parts of the OCamlGraph library, using the Cameleer tool.

We have stumbled upon oper.ml's intersect when trying to prove it. I am wondering on why it uses List.exists (fun e' -> G.E.compare e e' = 0) succ to test the membership of an edge e in successors succ. Wouldn't something along the lines of G.mem_edge_e e g2 be equivalent - with the benefit of using O(log n) lookup instead of O(n) that comes from List.exists?

Thank you,
Ion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions