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

Provide optional weights and metadata in one graph type #27

Open
CameronBieganek opened this issue Oct 13, 2023 · 1 comment
Open

Provide optional weights and metadata in one graph type #27

CameronBieganek opened this issue Oct 13, 2023 · 1 comment
Labels
question Further information is requested

Comments

@CameronBieganek
Copy link

CameronBieganek commented Oct 13, 2023

I think it's worth considering having one Graph type that can optionally include weights and metadata for an undirected graph, rather than having separate WeightedGraph and MetaGraph types. The Graph constructor could have various optional type parameters, so you could create empty graphs like this:

# Create a graph with `Any` vertex type, Float64 edge weights,
# and no metadata.
Graph()

# Char graph with Float64 edge weights:
Graph{Char}()

# Char graph with Int weights:
Graph{Char, Int}()  

# Char graph with Float64 edge weights and
# vertex data of type MyVertexData:
Graph{Char, Float64, MyVertexData}()

# Char graph with Float64 edge weights,
# vertex data of type MyVertexData,
# and edge data of type MyEdgeData:
Graph{Char, Float64, MyVertexData, MyEdgeData}()

# Char graph with Float64 edge weights,
# no vertex data, and edge data of type MyEdgeData:
Graph{Char, Float64, Nothing, MyEdgeData}()

Nothing would be an option for the metadata type parameters, but not for the vertex type and weight type. (Default weight type would probably be Float64.)

@gdalle
Copy link
Member

gdalle commented Oct 13, 2023

I like the idea, and from a user perspective it would be closer to the nice NetworkX experience. The only doubt I have is the overhead incurred by carrying empty vertex or edge metadata, but it's probably minor

@gdalle gdalle added the question Further information is requested label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants