Class: RGL::AdjacencyGraph

Inherits:
DirectedAdjacencyGraph show all
Defined in:
lib/rgl/adjacency.rb

Overview

AdjacencyGraph is an undirected Graph. The methods add_edge and remove_edge are reimplemented: If an edge (u,v) is added or removed, then the reverse edge (v,u) is also added or removed.

Instance Method Summary collapse

Methods inherited from DirectedAdjacencyGraph

[], #add_edge, #add_vertex, #each_adjacent, #each_vertex, #edgelist_class=, #has_edge?, #has_vertex?, #initialize, #initialize_copy, #remove_vertex

Methods included from MutableGraph

#add_edge, #add_edges, #add_vertex, #add_vertices, #cycles, #cycles_with_vertex, #from_graphxml, #remove_vertex, #remove_vertices

Methods included from Graph

#acyclic?, #adjacent_vertices, #bfs_iterator, #bfs_search_tree_from, #condensation_graph, #depth_first_search, #depth_first_visit, #dfs_iterator, #dotty, #each, #each_adjacent, #each_connected_component, #each_edge, #each_vertex, #edge_class, #edges, #edges_filtered_by, #empty?, #eql?, #has_vertex?, #implicit_graph, #num_edges, #out_degree, #print_dotted_on, #reverse, #size, #strongly_connected_components, #to_adjacency, #to_dot_graph, #to_s, #to_undirected, #topsort_iterator, #transitive_closure, #transitive_reduction, #vertices, #vertices_filtered_by, #write_to_graphic_file

Methods included from Enumerable

#length

Constructor Details

This class inherits a constructor from RGL::DirectedAdjacencyGraph

Instance Method Details

#directed?Boolean

Always returns false.

Returns:

  • (Boolean)


149
150
151
# File 'lib/rgl/adjacency.rb', line 149

def directed?				# Always returns false.
  false
end

#remove_edge(u, v) ⇒ Object

Also removes (v,u)



155
156
157
158
# File 'lib/rgl/adjacency.rb', line 155

def remove_edge (u, v)
  super
  @vertice_dict[v].delete(u) unless @vertice_dict[v].nil?
end