-
Notifications
You must be signed in to change notification settings - Fork 13
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
Should we add another parameter representing the hyperedge weight? #2
Comments
The default was that the weight of the HE is a sum of weights of vertices in this HE. This information can be cached if we would think that it would be good to have it precomputed. However, if we think that these two things should be decoupled it should be easy to add it. @pszufe what use-cases for different kinds weights do you see? |
I think that Carmine's proposal is valid for several cases where messages are being exchanged wihin a network. Here is a sample use case scenario for weighted HEs: Consider a hypergraph where edges represent agents acting on some market (for example making buying and selling decisions). The above scenario represents a group of models where on one hand the hypergraph is the most natural representation and on the other hand you need the hyperedge weights. |
I would say that positive/negative is an attribute of a hyperedge not a weight. This is then a general question do we want to equip hyperedges and vertices with arbitrary metadata? Regarding the weight of a hyperedge - I am OK to add it as it does not cost much (but still it would be good to have some use cases in mind). |
It seems the most reasonable solution is to make it possible to attach any values to hyperedges. Currently we have the following constructor for a Hypergraph{T}(n, k) where {T<:Real} I propose to add the following two constructors Hypergraph{T, V}(n, k) where {T<:Real}
Hypergraph{T, V, E}(n, k) where {T<:Real} where
In this way we allow any weight system but also other types of information to be stored at hyperedges and vertices. This means that our main data structure is going to look like this: struct Hypergraph{T,V,E} <: AbstractMatrix{Union{T, Nothing}}
v2he::Vector{Dict{Int,T}}
he2v::Vector{Dict{Int,T}}
vs::Vector{V}
hes::Vector{E}
Hypergraph{T}(n, k) where {T<:Real} =
new{T,Nothing,Nothing}([Dict{Int,T}() for i in 1:n], [Dict{Int,T}() for i in 1:k], Vector{Nothing}(nothing, n), Vector{Nothing}(nothing, k))
Hypergraph{T,V}(n, k) where {T<:Real, V} =
new{T,V,Nothing}([Dict{Int,T}() for i in 1:n], [Dict{Int,T}() for i in 1:k],Vector{V}(undef, n),Vector{Nothing}(nothing, k))
Hypergraph{T,V,E}(n, k) where {T<:Real, V, E} =
new{T,V,E}([Dict{Int,T}() for i in 1:n], [Dict{Int,T}() for i in 1:k],Vector{V}(undef,n),Vector{E}(undef,k))
end @spagnuolocarmine is this something you had in mind? |
I think that is fine for more generic data structure. Moreover, what we can do in several H views (such as bipartite or 2 section) is provide a constructor of the view that takes as argument a weight-function (defined to be able to compute the weight of an HE given as function argument), in this way we allow also to define the weight of an HE not only at struct build time. |
With more details, that means that the hyperedges (HE) can (also) have a weight associated to an HE. Currently each vertices in an HE have a particular weight.
For this reason is not clear which is the total weight of an HE.
We notice that this new value can also be mapped in the BipartiteView of the HyperGraph (H), as the weight of the node that represents the HE. Obviously this can be achieved (in more generic format) defining a method/function to compute the weight of each HE.
The text was updated successfully, but these errors were encountered: