Class: Silicium::Graphs::UnorientedGraph
- Inherits:
-
OrientedGraph
- Object
- OrientedGraph
- Silicium::Graphs::UnorientedGraph
- Defined in:
- lib/graph.rb
Overview
Class represents unoriented graph
Instance Method Summary collapse
-
#add_edge!(from, to) ⇒ Object
Adds edge to graph.
-
#delete_edge!(from, to) ⇒ Object
Deletes edge from graph.
-
#label_edge!(from, to, label) ⇒ Object
Adds label to edge.
Methods inherited from OrientedGraph
#add_edge_force!, #add_vertex!, #adjacted_with, #delete_vertex!, #edge_label_number, #edge_labels, #edge_number, #find_strongly_connected_components, #get_edge_label, #get_vertex_label, #has_edge?, #has_vertex?, #initialize, #label_vertex!, #reverse!, #vertex_label_number, #vertex_labels, #vertex_number, #vertices
Methods included from Silicium::Graphs
#add_to_queue, #add_to_stack, #breadth_first_search?, #connected?, #depth_first_search?, #dfs_traverse, #dfs_traverse_recursive, #dfu, #dijkstra_algorithm, #goal_node?, #graph_to_sets, #kruskal_mst, #number_of_connected, #sum_labels
Constructor Details
This class inherits a constructor from Silicium::Graphs::OrientedGraph
Instance Method Details
#add_edge!(from, to) ⇒ Object
Adds edge to graph
197 198 199 200 201 |
# File 'lib/graph.rb', line 197 def add_edge!(from, to) protected_add_edge!(from, to) protected_add_edge!(to, from) @edge_number += 1 end |
#delete_edge!(from, to) ⇒ Object
Deletes edge from graph
210 211 212 213 214 |
# File 'lib/graph.rb', line 210 def delete_edge!(from, to) protected_delete_edge!(from, to) protected_delete_edge!(to, from) @edge_number -= 1 end |
#label_edge!(from, to, label) ⇒ Object
Adds label to edge
204 205 206 207 |
# File 'lib/graph.rb', line 204 def label_edge!(from, to, label) super(from, to, label) super(to, from, label) end |