This is where navigation should be.


GSP_HYPERGRAPH - Initialize a hypergraph from a set of edges and weights

Usage

G = gsp_hypergraph(N,E);
G = gsp_hypergraph(N,E, w);
G = gsp_hypergraph(N,E, w, coords);
G = gsp_hypergraph(N, E, w, coords, limits);

Input parameters

N Number of nodes
E Set of edges (cell array)
w weights of the edges (default all ones)
coords Coordonates of the points (optional)
limits limits for the coordonates (optional)

Output parameters

G Graph structure.

Example:

N = 100;
Nf = 2;
k = 4;
x = rand(N,Nf);
paramnn.k = k;
[indx, indy, d] = gsp_nn_distanz(x',x',paramnn);
sigma = mean(d)^2;
wt = exp(-d.^2/sigma);
E = cell(N,1);
w = zeros(N,1);
for ii = 1:N
    edge = indx((1:k)+(ii-1)*k);
    E{ii} = edge;
    w(ii) = sum(wt(edge));
end

G = gsp_hypergraph(N,E,w)

This code produces the following output:

G =

  struct with fields:

             N: 100
            Ne: 400
             W: [100×100 double]
             E: {100×1 cell}
          type: 'hypergraph from edges'
      directed: 1
    hypergraph: 1
             A: [100×100 double]
      lap_type: 'normalized'
            de: [100×1 double]
            dv: [100×1 double]
             L: [100×100 double]
             d: [100×1 double]
        coords: []
      plotting: [1×1 struct]