Class | RGL::DirectedAdjacencyGraph |
In: |
lib/rgl/adjacency.rb
|
Parent: | Object |
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.
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.