Class: PetriNet::ReachabilityGraph

Inherits:
Graph
  • Object
show all
Defined in:
lib/petri_net/reachability_graph/graph.rb

Defined Under Namespace

Classes: Edge, InfinityNode, Node

Instance Attribute Summary

Attributes inherited from Graph

#net

Attributes inherited from Base

#logger

Instance Method Summary collapse

Methods inherited from Graph

#<<, #add_edge, #generate_gv, #get_node, #get_nodes, #to_gv, #to_s

Methods inherited from Base

#next_object_id, #reset

Constructor Details

#initialize(net, options = Hash.new) ⇒ ReachabilityGraph

Returns a new instance of ReachabilityGraph.



4
5
6
7
8
# File 'lib/petri_net/reachability_graph/graph.rb', line 4

def initialize(net, options = Hash.new)
    options[:type] = "Reachability"
    super(net, options)
    self
end

Instance Method Details

#add_node(node) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/petri_net/reachability_graph/graph.rb', line 10

def add_node(node)
    @nodes.each_value do |n|
        begin
            if @objects[n] < node
                raise PetriNet::InfiniteReachabilityGraphError
            end
        rescue ArgumentError
            #Just an InfiniteNode
        end

    end
    super node
end

#add_node!(node) ⇒ Object



24
25
26
# File 'lib/petri_net/reachability_graph/graph.rb', line 24

def add_node!(node)
    super node
end