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

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