Class: RGL::DOT::Edge

### Home Classes Methods

### In Files

- lib/rgl/rdot.rb

### Parent

RGL::DOT::Element

### Methods

- ::new
- #to_s

### Class/Module Index

Quicksearch

- RGL
- RGL::AdjacencyGraph
- RGL::BFSIterator
- RGL::BellmanFordAlgorithm
- RGL::BellmanFordVisitor
- RGL::BidirectionalGraph
- RGL::BipartiteBFSIterator
- RGL::DFSIterator
- RGL::DFSVisitor
- RGL::DOT
- RGL::DOT::Digraph
- RGL::DOT::DirectedEdge
- RGL::DOT::Edge
- RGL::DOT::Element
- RGL::DOT::Graph
- RGL::DOT::Node
- RGL::DOT::Port
- RGL::DOT::Subgraph
- RGL::DijkstraAlgorithm
- RGL::DijkstraVisitor
- RGL::DirectedAdjacencyGraph
- RGL::Edge
- RGL::Edge::DirectedEdge
- RGL::Edge::UnDirectedEdge
- RGL::EdgePropertiesMap
- RGL::EdmondsKarpAlgorithm
- RGL::EdmondsKarpAlgorithm::EdmondsKarpBFSIterator
- RGL::Graph
- RGL::Graph::TarjanSccVisitor
- RGL::GraphIterator
- RGL::GraphVisitor
- RGL::GraphVisitor::ClassMethods
- RGL::GraphVisitor::DistanceMapSupport
- RGL::ImplicitGraph
- RGL::MutableGraph
- RGL::MutableGraph::MutableGraphParser
- RGL::NoEdgeError
- RGL::NoVertexError
- RGL::NonNegativeEdgePropertiesMap
- RGL::NotDirectedError
- RGL::NotUndirectedError
- RGL::PrimAlgorithm
- RGL::TopsortIterator
- Enumerable
- Object

No matching classes.

# RGL::DOT::Edge

This is an undirected edge representation.

### Attributes

from[RW]

A node or subgraph reference or instance to be used as the starting point for an edge.

to[RW]

A node or subgraph reference or instance to be used as the ending point for an edge.

### Public Class Methods

new(params = {}, option_list = EDGE_OPTS) click to toggle source

Creates a new Edge with the params Hash providing settings for all edge options. The option_list parameter restricts those options to the list of valid names it contains.

    # File lib/rgl/rdot.rb, line 430
    def initialize(params = {}, option_list = EDGE_OPTS)
      super(params, option_list)
      @from = params['from'] ? params['from'] : nil
      @to   = params['to'] ? params['to'] : nil
    end

### Public Instance Methods

to_s(leader = '', indent = ' ') click to toggle source

Returns a string representation of this edge which is consumable by the graphviz tools `dot` and `neato`. The leader parameter is used to indent every line of the returned string, and the indent parameter is used to additionally indent nested items.

    # File lib/rgl/rdot.rb, line 441
    def to_s(leader = '', indent = '    ')
      stringified_options = @options.collect do |name, val|
        unless val.nil?
          leader + indent + "#{quote_ID(name)} = #{quote_ID(val)}"
        end
      end.compact.join(",\n")

      f_s = @from || ''
      t_s = @to || ''

      if stringified_options.empty?
        leader + quote_ID(f_s) + ' ' + edge_link + ' ' + quote_ID(t_s)
      else
        leader + quote_ID(f_s) + ' ' + edge_link + ' ' + quote_ID(t_s) + " [\n" +
            stringified_options + "\n" +
            leader + "]"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.