Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Add weighted edges using coupling strategy weight
Browse files Browse the repository at this point in the history
  • Loading branch information
floriandejonckheere committed Mar 31, 2024
1 parent db2cb34 commit d4f7390
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/mosaik/extractors/evolution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def call
next if value.zero?

# Add a weighted edge to the graph
graph.add_directed_edge(a, b, count: value)
graph.add_directed_edge(a, b, weight: value * options[:logical])
end
end
end
Expand All @@ -76,7 +76,7 @@ def call
next if contributors[a].empty? || contributors[b].empty?

# Add a weighted edge to the graph (weight is the cardinality of the intersection of sets)
graph.add_directed_edge(a, b, count: (contributors[a] & contributors[b]).count)
graph.add_directed_edge(a, b, weight: (contributors[a] & contributors[b]).count * options[:contributor])
end
end

Expand Down
3 changes: 2 additions & 1 deletion lib/mosaik/extractors/structural.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def construct(constant)
debug "Edge from #{caller.value} to #{receiver.value}##{reference.method}"

# Add an edge from the constant to the receiver
graph.add_directed_edge(caller.value, receiver.value, method: reference.method)
# FIXME: aggregate edges with the same method
graph.add_directed_edge(caller.value, receiver.value, method: reference.method, weight: options[:structural])
end
end
end
Expand Down

0 comments on commit d4f7390

Please sign in to comment.