Class RGL::DirectedAdjacencyGraph
In: lib/rgl/adjacency.rb
Parent: Object

Methods

Included Modules

MutableGraph

Public Class methods

Shortcut for creating a DirectedAdjacencyGraph:

 RGL::DirectedAdjacencyGraph[1,2, 2,3, 2,4, 4,5].edges.to_a.to_s =>
   "(1-2)(2-3)(2-4)(4-5)"

Returns a new empty DirectedAdjacencyGraph which has as its edgelist class the given class. The default edgelist class is Set, to ensure set semantics for edges and vertices.

If other graphs are passed as parameters their vertices and edges are added to the new graph.

Public Instance methods

See MutableGraph#add_vertex.

If the vertex is already in the graph (using eql?), the method does nothing.

Returns true.

Iterator for the keys of the vertice list hash.

Converts the adjacency list of each vertex to be of type klass. The class is expected to have a new contructor which accepts an enumerable as parameter.

Complexity is O(1), if a Set is used as adjacency list. Otherwise, complexity is O(out_degree(v)).


MutableGraph interface.

Complexity is O(1), because the vertices are kept in a Hash containing as values the lists of adjacent vertices of v.

Copy internal vertice_dict

See MutableGraph::remove_edge.

Protected Instance methods

[Validate]