class Twb::Util::Graphedge
Attributes
from[R]
@from - the origin node @to - the destination node @relationship - useful for categorizing the edge @properties - useful for categorizing the edge
properties[RW]
relationship[R]
@from - the origin node @to - the destination node @relationship - useful for categorizing the edge @properties - useful for categorizing the edge
to[R]
@from - the origin node @to - the destination node @relationship - useful for categorizing the edge @properties - useful for categorizing the edge
Public Class Methods
new(from:, to:, relationship:, properties: {})
click to toggle source
Neo4J cypher variable quote character: `
# File lib/twb/util/graphedge.rb, line 31 def initialize (from:, to:, relationship:, properties: {}) raise ArgumentError.new("from: parameter must be a Graphnode, is a '#{from.class}'") unless from.is_a? Twb::Util::Graphnode raise ArgumentError.new( "to: parameter must be a Graphnode, is a '#{to.class}'" ) unless to.is_a? Twb::Util::Graphnode @from = from @to = to @relationship = relationship @properties = properties # @cypherCreate = "CREATE #{cypher_s}" end
Public Instance Methods
dot()
click to toggle source
# File lib/twb/util/graphedge.rb, line 53 def dot "%s -> %s" % [from.dotid, to.dotid] end
eql?(other)
click to toggle source
# File lib/twb/util/graphedge.rb, line 41 def eql? other @from == other.from && @to == other.to && @relationship == other.relationship && @properties == other.properties end
gml()
click to toggle source
# File lib/twb/util/graphedge.rb, line 57 def gml "edge [ id %s\n source \"%s\"\n target \"%s\"\n ]" % [@from, @to] end
hash()
click to toggle source
# File lib/twb/util/graphedge.rb, line 45 def hash [@from.hash, @to.hash, @relationship, @properties].hash end
to_s()
click to toggle source
# File lib/twb/util/graphedge.rb, line 49 def to_s "'#{@from.name}//{@from.id}' --#{@relationship}--> '#{@to.name}//#{@to.id}'" end