Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algebraic Hypergraph #239

Open
jmatsushita opened this issue Oct 11, 2019 · 2 comments
Open

Algebraic Hypergraph #239

jmatsushita opened this issue Oct 11, 2019 · 2 comments
Labels

Comments

@jmatsushita
Copy link

Hi there,

I was reading your blog post which mention the possibility of a decomposition for k-edges which could be applied to (IIUC) hypergraphs of with hyperedges of a fixed order k.
Have you considered this type, using the (hyper)edge-labelled data type and considering e as a Monoid as you suggest?

data HyperGraph e a = Empty
                    | Vertex a
                    | Connect e (Set (HyperGraph e a))

The more basic type seems like it would also make sense:

data HyperGraph a = Empty
                  | Vertex a 
                  | Overlay (Set (HyperGraph a))
                  | Connect (Set (HyperGraph a))

Would you anticipate difficulties pursuing this further?

Cheers,

Jun

@snowleopard
Copy link
Owner

@jmatsushita Yes, I've been thinking about such representations to support hyperedges, however, I used lists in my experiments because with Set you essentially force the algebra to be commutative with respect to Connect, i.e. you won't be able to express both 1*2 and 2*1. Perhaps, this is fine for your application.

Another subtlety is that with Set you seem to lose the ability to create single vertices that have self-loops, e.g. 1*1. Strangely you can still create more complex graphs with self-loops such as 1*(1+2): here 1 has a self-loop.

So, Set seems a bit awkward. I'd probably use the following data type as a starting point:

data HyperGraph e a = Vertex a
                    | Connect e [HyperGraph e a]

empty :: Monoid e => HyperGraph e a
empty = Connect mempty []

I haven't done much with representation, so please let me know if you come up with anything interesting!

@snowleopard
Copy link
Owner

I suggest we keep this PR open, since hypergraphs seem like an interesting direction to explore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants