Create only undirected edges from smaller node ID to higher node ID

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2024-05-30 21:07:23 -07:00
parent c17142e648
commit b2b225f4ae

View File

@ -103,6 +103,7 @@ series.each do |series, files|
end end
edges.uniq! edges.uniq!
# edges.filter! { |e| e[:from] < e[:to] } # edges.filter! { |e| e[:from] < e[:to] }
edges.map! { |e| { :from => [e[:from], e[:to]].min, :to => [e[:from], e[:to]].max } }.uniq!
puts ("export const nodes = " + JSON.pretty_unparse(data.values) + ";") puts ("export const nodes = " + JSON.pretty_unparse(data.values) + ";")
puts ("export const edges = " + JSON.pretty_unparse(edges) + ";") puts ("export const edges = " + JSON.pretty_unparse(edges) + ";")