working with hypergraphs - node_x_edge input

Hi,

I wonder how one can work with hyper-graphs using graph-tool. For example
in my work, I would like to feed a data where rows are journals and columns
are papers out-going citations. I understand such a binary matrix, can not
be used as an adjacency matrix but I am curious if it is possible to work
with this type of input. Otherwise, I appreciate to hear your thoughts on
converting this matrix into a adjacency matrix.

Br
Alireza

attachment.html (537 Bytes)

Ni! Hi Alireza,

One way to work with hypergraphs is to use the incidence graph
<https://en.wikipedia.org/wiki/Hypergraph&gt; representation of the hypergraph.

Abraços,
ale
.~´

attachment.html (1.47 KB)

Thanks Alexander,

May be my question was not clear enough - as you said, my data is already
an incident matrix.
I would like to use stochastic-block-models, and seems they only work with
adjacency matrices. Therefore, I wonder what are the possibilities to
work-around this problem.

Br

attachment.html (2.53 KB)

Ni!

Incidence matrices can be trated as a subset of an adjacency matrix (and in
this sense hypergraphs as a special case of graphs), so in principle there
is no problem to work around. You just need to properly interpret the model
in terms of membership to hyperedges instead of connections to nodes.

You should hardcode the bipartite structure when running the DL
minimization in order to save processing time (see the pclabel param).

If you're convinced that this doesn't suite your needs, you should
explicitly formulate your conceptual issue so we can provide useful advice.

Cheers!

.~´

attachment.html (3.96 KB)

Dear Alexander,

Thanks for your answer, regarding the treatment,
For example, if my data looks like

p1 p2 p3 p4 p5 p6
j1 1 0 1 0 1 0
j2 0 1 1 0 0 1
j3 0 0 0 1 1 1
j4 1 0 0 1 0 0

are you suggesting to treat it as

j1 j2 j3 j4 p1 p2 p3 p4 p5 p6
j1 0 0 0 0 1 0 1 0 1 0
j2 0 0 0 0 0 1 1 0 0 1
j3 0 0 0 0 0 0 0 1 1 1
j4 0 0 0 0 1 0 0 1 0 0
p1 1 0 0 1 0 0 0 0 0 0
p2 0 1 0 0 0 0 0 0 0 0
p3 1 1 0 0 0 0 0 0 0 0
p4 0 0 1 1 0 0 0 0 0 0
p5 1 0 1 0 0 0 0 0 0 0
p6 0 1 1 0 0 0 0 0 0 0

to be an adjacency matrix ?
Thanks,

attachment.html (49.4 KB)

Ni! Hi Alireza,

Yep, that's what I meant.

As a note, this is what the adjacency matrix for any bipartite graph can be
reordered to look like - or undirected bipartite graph in your particular
case.

Note that in SBM terms this corresponds to two blocks that only connect
across, which is why one should impose that constraint using `pclabel`,
sparing the algorithm from inferring it.
(And in a hypergraph interpretation you likely wouldn't want blocks mixing
hyperedges and nodes to start with.)

[]s
ale
.~´

attachment.html (49.9 KB)