Module: RGFA::Paths
- Included in:
- RGFA
- Defined in:
- lib/rgfa/paths.rb
Overview
Methods for the RGFA class, which allow to handle paths in the graph.
Instance Method Summary collapse
-
#delete_path(pt) ⇒ RGFA
Delete a path from the RGFA graph.
-
#path(pt) ⇒ RGFA::Line::Path?
Searches the path with name equal to
pt
. -
#path!(pt) ⇒ RGFA::Line::Path
Searches the path with name equal to
pt
. -
#paths ⇒ Array<RGFA::Line::Path>
All path lines of the graph.
-
#paths_with(s) ⇒ Array<RGFA::Line::Path>
Paths whose
segment_names
include the specified segment.
Instance Method Details
#delete_path(pt) ⇒ RGFA
Delete a path from the RGFA graph
57 58 59 60 61 62 63 |
# File 'lib/rgfa/paths.rb', line 57 def delete_path(pt) pt = path!(pt) pt.segment_names.each {|sn, o| segment!(sn).paths[o].delete(pt)} pt.links.each {|l, dir| l.paths.delete([pt, dir])} @paths.delete(pt.path_name) return self end |
#path(pt) ⇒ RGFA::Line::Path?
Searches the path with name equal to pt
.
77 78 79 80 |
# File 'lib/rgfa/paths.rb', line 77 def path(pt) return pt if pt.kind_of?(RGFA::Line) @paths[pt.to_sym] end |
#path!(pt) ⇒ RGFA::Line::Path
Searches the path with name equal to pt
.
84 85 86 87 88 |
# File 'lib/rgfa/paths.rb', line 84 def path!(pt) pt = path(pt) raise RGFA::LineMissingError, "No path has name #{pt}" if pt.nil? pt end |
#paths ⇒ Array<RGFA::Line::Path>
All path lines of the graph
67 68 69 |
# File 'lib/rgfa/paths.rb', line 67 def paths @paths.values end |
#paths_with(s) ⇒ Array<RGFA::Line::Path>
Returns paths whose segment_names
include the specified segment.
94 95 96 |
# File 'lib/rgfa/paths.rb', line 94 def paths_with(s) segment!(s).all_paths end |