Used to parse a subset of GraphML into an RGL graph implementation.
First resets graph to be empty and stores a reference for use with tag_start.
# File lib/rgl/graphxml.rb, line 26 def initialize (graph) @graph = graph @graph.remove_vertices(@graph.vertices) end
Processes incoming edge and node elements from GraphML in order to populate the graph given to new.
# File lib/rgl/graphxml.rb, line 33 def tag_start (name, attrs) case name when 'edge' @graph.add_edge(attrs['source'], attrs['target']) when 'node' @graph.add_vertex(attrs['id']) end end
Generated with the Darkfish Rdoc Generator 2.