acxz / SimpleLazyGraphs.jl

Graph data structures to add vertices and edges as needed for Graphs.jl.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SimpleLazyGraphs

Build Status

Graphs that lazily expand.

In particular, SimpleLazyGraphs create new vertices and edges as needed.

Installation

In Julia REPL:

]add SimpleLazyGraphs

Example Usage

using SimpleLazyGraphs

function neighbors_lazy(v::Integer)
    neighbors = []
    if v == 1
        neighbors = [2, 3]
    elseif v == 2
        neighbors = [1, 3]
    elseif v == 3
        neighbors = [1, 2]
    end
    return neighbors
end

g = SimpleLazyGraph(neighbors_lazy)
add_vertex!(g)
add_vertex!(g)
outneighbors(g, 1)
outneighbors(g, 2)

About

Graph data structures to add vertices and edges as needed for Graphs.jl.

License:MIT License


Languages

Language:Julia 100.0%