Class: RGL::AdjacencyGraph

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

Overview

AdjacencyGraph is an undirected Graph. The methods DirectedAdjacencyGraph#add_edge and DirectedAdjacencyGraph#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, #bellman_ford_shortest_paths, #bfs_iterator, #bfs_search_tree_from, #bipartite?, #bipartite_sets, #condensation_graph, #depth_first_search, #depth_first_visit, #dfs_iterator, #dijkstra_shortest_path, #dijkstra_shortest_paths, #dotty, #each, #each_adjacent, #each_connected_component, #each_edge, #each_vertex, #edge_class, #edges, #edges_filtered_by, #empty?, #eql?, #has_edge?, #has_vertex?, #implicit_graph, #maximum_flow, #num_edges, #out_degree, #path?, #prim_minimum_spanning_tree, #print_dotted_on, #reverse, #set_edge_options, #set_vertex_options, #size, #strongly_connected_components, #to_adjacency, #to_dot_graph, #to_s, #to_undirected, #topsort_iterator, #transitive_closure, #transitive_reduction, #vertex_id, #vertex_label, #vertices, #vertices_filtered_by, #write_to_graphic_file

Constructor Details

This class inherits a constructor from RGL::DirectedAdjacencyGraph

Instance Method Details

#directed?Boolean

Returns false.

Returns:

  • (Boolean)

    false.



144
145
146
# File 'lib/rgl/adjacency.rb', line 144

def directed?
  false
end

#remove_edge(u, v) ⇒ Object

Also removes (v,u)



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

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