Class RGL::Edge::DirectedEdge
In: lib/rgl/base.rb
Parent: Object

Simply a directed pair (source -> target). Most library functions try do omit to instantiate edges. They instead use two vertex parameters for representing edges (see each_edge). If a client wants to store edges explicitly DirecteEdge or UnDirectedEdge instances are returned (i.e. Graph#edges).

Methods

<=>   ==   []   []   eql?   new   reverse   to_a   to_s  

Attributes

source  [RW] 
target  [RW] 

Public Class methods

Can be used to create an edge from a two element array.

Create a new DirectedEdge with source a and target b.

Public Instance methods

Sort support is dispatched to the <=> method of Array

==(edge)

Alias for eql?

Edges can be indexed. edge[0] == edge.source, edge[n] == edge.target for all n>0. Edges can thus be used as a two element array.

Two directed edges (u,v) and (x,y) are equal iff u == x and v == y. eql? is needed when edges are inserted into a Set. eql? is aliased to ==.

Returns (v,u) if self == (u,v).

Returns the array [source,target].

DirectedEdge[1,2].to_s == "(1-2)"

[Validate]