Skip to content

Custom graph invariants #70

@JeffreyBenjaminBrown

Description

@JeffreyBenjaminBrown

Is there a some canonical way to enforce graph invariants in FGL?

I have been using FGL to implement a generalization of graphs that allows for arbitrary arity and nesting of relationships. It looks like this:

type RSLT = Gr Expr Role
data Expr = Word String
          | Template [String] -- e.g. "_ needs _ to _"
          | Relationship      -- e.g. "Gotham needs Batman to hurry"
data Role = TemplateRole | Member Int

Words and Templates emit no edges. Each Relationship emits an edge labeled "TemplateRole" to a Template of arity k, and k more edges, labeled "Member i" for i in [1,k]. Thus the model permits lots of invalid state.

I don't know whether it's relevant, but I just learned about the dependent map library, which implements a map that allows keys to specify the types of values associated with them.

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