Skip to content

It's all about graphs, right? #64

@mauro-milella

Description

@mauro-milella

Hi guys,

Do you see any differences between graph theory and modal symbolic learning?
I don't, maybe I am being quite superficial?

I am writing this issue to anticipate the refactoring/simplification work are going to do in the next months.

This is a fragment of code I just wrote in ModalAssociationRules.jl, to fit my experiments with generic AbstractDataset types rather than UniformFullDimensionalDatasets. It is inspired by some code I read from @alberto-paparella.

Do you think this is garbage? The underlying philosophy is: please, gimme my graph, gimme my coloured edges, and let me fix which symbol holds on every node.

No jungle types. Stick to Graphs.jl as much as possible, and keep it simple. No strongly-coupled code enabling heavy optimizations.

struct Logiset <: SoleData.AbstractLogiset
    instances::Vector{KripkeStructure}
end

After the above, we could implement the standard Vector interface via @forward macro (Lazy.jl package). Something like:

@forward Logiset.instances Logiset begin
    length
    getindex
    setindex!
    push!
    pop!
    iterate
end

The rest could be something like:

# this is not the complete interface, but only a few dispatches I needed in ModalAssociationRules.jl

function instances(logiset::Logiset)
    return logiset.instances
end

function ninstances(logiset::Logiset)
    return logiset |> length # and this is a renaming for length(::Vector{KripkeStructure}), because of @forward
end

function getinstance(
    logiset::Logiset,
    i::Int64
)::SoleLogics.LogicalInstance
    return SoleLogics.LogicalInstance(
        SoleLogics.InterpretationVector(logiset |> instances), i)
end

function frame(logiset::Logiset, i::Int64)
    instances(logiset)[i] |> frame
end

Metadata

Metadata

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