Module | RGL::MutableGraph |
In: |
lib/rgl/graphxml.rb
lib/rgl/mutable.rb |
A MutableGraph can be changed via the addition or removal of edges and vertices.
Inserts the edge (u,v) into the graph.
Note that for undirected graphs, (u,v) is the same edge as (v,u), so after a call to the function add_edge(), this implies that edge (u,v) will appear in the out-edges of u and (u,v) (or equivalently (v,u)) will appear in the out-edges of v. Put another way, v will be adjacent to u and u will be adjacent to v.
Add all edges in the edges array to the edge set. Elements of the array can be both two-element arrays or instances of DirectedEdge or UnDirectedEdge.
Add a new vertex v to the graph. If the vertex is already in the graph (tested via eql?), the method does nothing.
Returns an array of all minimum cycles in a graph
This is not an efficient implementation O(n^4) and could be done using Minimum Spanning Trees. Hint. Hint.
Initializes an RGL graph from a subset of the GraphML format given in source (see www.graphdrawing.org/graphml).
Remove the edge (u,v) from the graph. If the graph allows parallel edges, this removes all occurrences of (u,v).
Precondition: u and v are vertices in the graph. Postcondition: (u,v) is no longer in the edge set for g.
Remove u from the vertex set of the graph. All edges whose target is v are also removed from the edge set of the graph.
Postcondition: num_vertices is one less, v no longer appears in the vertex set of the graph, and there no edge with source or target v.
Remove all vertices specified by the array a from the graph by calling remove_vertex.