Skip to content

Review of the improved bundle closure algorithm. #22

@NicolasRouquette

Description

@NicolasRouquette

See: https://github.com/JPL-IMCE/gov.nasa.jpl.imce.ontologies.tools/blob/861e95f779394dbfaabdcc04b149c6c076fa4b73/lib/BundleClosure/lib/graph.rb

def merge_vertices(s)
    new_vertex = Union.new(s.inject(Set.new) { |m, o| m = m.union(o.classes) })

    g = RGL::DirectedAdjacencyGraph.new
    edges.each do |edge|
      if s.include?(edge.target)
        g.add_edge(edge.source, new_vertex)
      elsif s.include?(edge.source)
        g.add_edge(new_vertex, edge.target)
      else
        g.add_edge(edge.source, edge.target)
      end
    end
    
    Graph.new(g.transitive_reduction)
  end

In the above, need to improve the checks to make sure that an edge is added if and only if
both edge.souce and edge.target are not in s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions