Skip to content

Different code- vs. label- API for has_edge vs. add_edge! #78

Description

@thchr

Example below:

g = SimpleGraph()
mg = MetaGraph(g, String, Nothing, Nothing)
for c in 'a':'d'
    add_vertex!(mg, string(c))
end
add_edge!(mg, "a", "b")
has_edge(mg, "a", "b")
ERROR: method has_edge not implemented.

I.e., add_edge! works on the labels of the MetaGraph but has_edge works with the codes. This is especially surprising if you (contrary to recommendations) go with Integer labels:

g = SimpleGraph()
mg = MetaGraph(g, Int, Nothing, Nothing) # <--- Int label
for i in 3:6
    add_vertex!(mg, i)
end
add_edge!(mg, 3, 4)
has_edge(mg, 3, 4)

(where, current API requires us to do has_edge(mg, code_for(mg, 3), code_for(mg, 4)) to get a meaningful result.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions