Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

[DISCUSSION] Design of Network #1

@CarloLucibello

Description

@CarloLucibello

I think that the easiest and most effective to implement a Network ( a graph also able to store edge and vertex properties), would require a little change in the direction of abstraction in LightGraphs.jl.
Its a matter of few lines of code and have the following type structure:

abstract SimpleGraph

"""
Abstract graph type
Requirements: 
  - vertices are numbers in [1,N]
  - edges are pair of vertices
  - ... minimal api... (add/remove vertex/edge etc..)
"""
abstract Graph <: SimpleGraph

type LightGraph <: Graph 
    vertices::UnitRange{Int}
    edges::Set{Edge}
    fadjlist::Vector{Vector{Int}} # [src]: (dst, dst, dst)
    badjlist::Vector{Vector{Int}} # [dst]: (src, src, src)
end

Then in Networks.jl we could have

"""
Abstract Network type
Requirements: 
  - Graph requirements + additional ones
"""
abstract Network <: Graph

type LightNetwork <: Network
    vertices::UnitRange{Int}
    edges::Set{Edge}
    fadjlist::Vector{Vector{Int}} # [src]: (dst, dst, dst)
    badjlist::Vector{Vector{Int}} # [dst]: (src, src, src)
    ... additional data.....
end

type DynamicNetwork <: Network
    vertices::UnitRange{Int}
    edges::Set{Edge}
    fadjlist::Vector{Vector{Int}} # [src]: (dst, dst, dst)
    badjlist::Vector{Vector{Int}} # [dst]: (src, src, src)
    ... additional data.....
end

And obtain for free all the functionality of LightGraph, without any metaprogramming trick.
I wonder what @sbromberger and @jpfairbanks think about this...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions