Class: Roby::Relations::ForkMergeVisitor::SubgraphDegreeCounter Private

Inherits:
RGL::DFSVisitor
  • Object
show all
Defined in:
lib/roby/relations/fork_merge_visitor.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A visitor that counts the in/out degree of vertices contained in a subgraph

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ SubgraphDegreeCounter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SubgraphDegreeCounter.



57
58
59
60
61
# File 'lib/roby/relations/fork_merge_visitor.rb', line 57

def initialize(graph)
    @out_degree = Hash.new(0)
    @in_degree = Hash.new(0)
    super(graph)
end

Instance Attribute Details

#in_degreeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



55
56
57
# File 'lib/roby/relations/fork_merge_visitor.rb', line 55

def in_degree
  @in_degree
end

#out_degreeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



55
56
57
# File 'lib/roby/relations/fork_merge_visitor.rb', line 55

def out_degree
  @out_degree
end

Instance Method Details

#handle_back_edge(u, v) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



68
69
70
71
# File 'lib/roby/relations/fork_merge_visitor.rb', line 68

def handle_back_edge(u, v)
    out_degree[u] += 1
    in_degree[v] += 1
end

#handle_forward_edge(u, v) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



73
74
75
76
# File 'lib/roby/relations/fork_merge_visitor.rb', line 73

def handle_forward_edge(u, v)
    out_degree[u] += 1
    in_degree[v] += 1
end

#handle_tree_edge(u, v) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



63
64
65
66
# File 'lib/roby/relations/fork_merge_visitor.rb', line 63

def handle_tree_edge(u, v)
    out_degree[u] += 1
    in_degree[v] += 1
end