Sha256: 08cf01c770fa5245a272c1bc0efdabfa1c5c57a239d99ca0084819c0e26bf90d
Contents?: true
Size: 940 Bytes
Versions: 3
Compression:
Stored size: 940 Bytes
Contents
module Pione module PNML # `IsolatedElementElimination` is a net rewriting rule. This rule removes # isolated elememts from nets. module IsolatedElementElimination # Find subjects(an isolated element) by following criteria. # # - There is a place or transition. # - It has no arcs. def self.find_subjects(net) (net.places + net.transitions).each do |node| input_arcs = net.find_all_arcs_by_source_id(node.id) output_arcs = net.find_all_arcs_by_target_id(node.id) if input_arcs.empty? and output_arcs.empty? return [node] end end return nil end # Rewrite the net by eliminating isolated node. def self.rewrite(net, subjects) subjects.each do |node| # eliminate the node net.transitions.delete(node) net.places.delete(node) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pione-0.4.2 | lib/pione/pnml/isolated-element-elimination.rb |
pione-0.4.1 | lib/pione/pnml/isolated-element-elimination.rb |
pione-0.4.0 | lib/pione/pnml/isolated-element-elimination.rb |