Module: GRATR::GraphAPI
- Included in:
- Graph
- Defined in:
- lib/gratr/graph_api.rb
Overview
This defines the minimum set of functions required to make a graph class that can use the algorithms defined by this library
Instance Method Summary collapse
-
#add_edge!(u, v = nil, l = nil) ⇒ Object
Add an edge to the Graph and return the Graph u can be an object of type GRATR::Arc or u,v specifies a source, target pair.
-
#add_vertex!(v, l = nil) ⇒ Object
Add a vertex to the Graph and return the Graph An additional label l can be specified as well.
-
#chromatic_number ⇒ Object
Return the chromatic number for this graph This is currently incomplete and in some cases will be NP-complete FIXME: Should this even be here? My gut feeling is no…
-
#directed? ⇒ Boolean
Is the graph directed?.
-
#edge_class ⇒ Object
Returns the edge class.
-
#edges ⇒ Object
Return the array of edges.
-
#remove_edge!(u, v = nil) ⇒ Object
Remove an edge from the Graph and return the Graph.
-
#remove_vertex!(v) ⇒ Object
Remove a vertex to the Graph and return the Graph.
-
#vertices ⇒ Object
Return the array of vertices.
Instance Method Details
#add_edge!(u, v = nil, l = nil) ⇒ Object
Add an edge to the Graph and return the Graph u can be an object of type GRATR::Arc or u,v specifies a source, target pair. The last parameter is an optional label
This method must be implemented by the specific graph class
51 |
# File 'lib/gratr/graph_api.rb', line 51 def add_edge!(u,v=nil,l=nil) raise NotImplementedError; end |
#add_vertex!(v, l = nil) ⇒ Object
Add a vertex to the Graph and return the Graph An additional label l can be specified as well
This method must be implemented by the specific graph class
44 |
# File 'lib/gratr/graph_api.rb', line 44 def add_vertex!(v,l=nil) raise NotImplementedError; end |
#chromatic_number ⇒ Object
Return the chromatic number for this graph This is currently incomplete and in some cases will be NP-complete FIXME: Should this even be here? My gut feeling is no…
80 |
# File 'lib/gratr/graph_api.rb', line 80 def chromatic_number() raise NotImplementedError; end |
#directed? ⇒ Boolean
Is the graph directed?
This method must be implemented by the specific graph class
38 |
# File 'lib/gratr/graph_api.rb', line 38 def directed?() raise NotImplementedError; end |
#edge_class ⇒ Object
Returns the edge class
75 |
# File 'lib/gratr/graph_api.rb', line 75 def edge_class() raise NotImplementedError; end |
#edges ⇒ Object
Return the array of edges.
This method must be implemented by the specific graph class
72 |
# File 'lib/gratr/graph_api.rb', line 72 def edges() raise NotImplementedError; end |
#remove_edge!(u, v = nil) ⇒ Object
Remove an edge from the Graph and return the Graph
Can be a type of GRATR::Arc or a source and target This method must be implemented by the specific graph class
62 |
# File 'lib/gratr/graph_api.rb', line 62 def remove_edge!(u,v=nil) raise NotImplementedError; end |
#remove_vertex!(v) ⇒ Object
Remove a vertex to the Graph and return the Graph
This method must be implemented by the specific graph class
56 |
# File 'lib/gratr/graph_api.rb', line 56 def remove_vertex!(v) raise NotImplementedError; end |
#vertices ⇒ Object
Return the array of vertices.
This method must be implemented by the specific graph class
67 |
# File 'lib/gratr/graph_api.rb', line 67 def vertices() raise NotImplementedError; end |