Skip to content

Provide optional weights and metadata in one graph type #27

@CameronBieganek

Description

@CameronBieganek

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions