Hi,
I am trying to understand FeaturedGraph
from GraphSignals.jl
. I am puzzled with the documentation, which says that features of edges are stored in matrix, where each column corresponds to a feature of one edge, but the documentation does not say, how edges are ordereded. I have created a workarround, where I first create a FeaturedGraph without any features and then iterate over edges to figure out the order.
using GraphSignals, Graphs
N = 4
ug = Graph(N)
add_edge!(ug, 1, 2); add_edge!(ug, 1, 3); add_edge!(ug, 1, 4);
add_edge!(ug, 2, 3); add_edge!(ug, 3, 4);
epmap = Dict([e => i for (i,e) in enumerate(edges(ug))])
fg = FeaturedGraph(ug)
ef = zeros(Float32, 5, ne(ug));
for (i, (vi, vj)) in edges(fg)
e = (vi < vj) ? Edge(vi, vj) : Edge(Int64(vj), Int64(vi))
ef[epmap[e], i] = 1
end
fg = FeaturedGraph(ug; ef)
But this construction seems to me a bit bizarre and I would consider it to be more like a work-around rather than a proper construction. Does someone knows the answer?
Thanks a lot in advance.
Tomas