Class: RGL::Edge::UnDirectedEdge

Inherits:
DirectedEdge show all
Defined in:
lib/rgl/base.rb

Overview

An undirected edge is simply an undirected pair (source, target) used in undirected graphs.

Examples:

UnDirectedEdge[u,v] == UnDirectedEdge[v,u]

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from RGL::Edge::DirectedEdge

Instance Method Details

#eql?(edge) ⇒ Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/rgl/base.rb', line 105

def eql?(edge)
  super || ((target == edge.source) && (source == edge.target))
end

#to_sString

Examples:

UnDirectedEdge[1,2].to_s == "(1=2)"

Returns:

  • (String)


112
113
114
# File 'lib/rgl/base.rb', line 112

def to_s
  "(#{source}=#{target})"
end