IO

The section will take you through functions that you can use for IO. We can divide IO into two categories: Reading Data and Writing Data.

Reading Data

Instead of querying data (Querying Clients), if you already have the data you care about, you can read it.

julia> TheGraphData.read("myfile.csv")
4-element CSV.File:
 CSV.Row: (X = "b",)
 CSV.Row: (X = "c",)
 CSV.Row: (X = "a",)
 CSV.Row: (X = "c",)
TheGraphData.readFunction
read(f::AbstractString; kwargs...)
read(::Union{Val{:csv},Val{:txt}}, f::AbstractString; kwargs...)

Read the data from the filepath f with kwargs.

This function is unexported. It will raise a MethodError if the specified filetype and datatype are not yet implemented. Please submit a PR or feature request if you want this particular combo to be supported.

source

Oftentimes, you will want to chain TheGraphData.read with a reformatting function (Reformatting Queried Data) to put the data into a nicer format.

julia> TheGraphData.read("myfile.csv") |> table
Table with 1 column and 4 rows:
     X
   ┌──
 1 │ b
 2 │ c
 3 │ a
 4 │ c

Writing Data

After running an experiment, you may want to save the final state. Or perhaps you want to save the experiment's initial state so as to repeat the experiment. We support these use cases, among others, by allowing you to write data to disk.

julia> t = Table(a = [1, 2, 3])
Table with 1 column and 3 rows:
     a
   ┌──
 1 │ 1
 2 │ 2
 3 │ 3
julia> TheGraphData.write("myfile.csv", t)
"myfile.csv"
TheGraphData.writeFunction
write(f::AbstractString, d; kwargs...)
write(v::Val, f::AbstractString, d; kwargs...)
write(::IsCSV, f::AbstractString, d::T; kwargs...) where {T<:Table}
write(::IsCSV, f::AbstractString, d::T; kwargs...) where {T<:FlexTable}
write(::IsCSV, f::AbstractString, d::D; kwargs...) where {D<:Dict}

Write the data d to the filepath f with kwargs.

This function is unexported. It will raise a MethodError if the specified filetype and datatype are not yet implemented. Please submit a PR or feature request if you want this particular combo to be supported.

source

Helper Functions