Parent

Methods

Included Modules

Files

RGL::MutableGraph::MutableGraphParser

Used to parse a subset of GraphML into an RGL graph implementation.

Public Class Methods

new(graph) click to toggle source

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

Public Instance Methods

tag_start(name, attrs) click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.