class Graphlb::DataStructures::Node
- Graphlb::DataStructures::Node
- Reference
- Object
Overview
The node Class basically represnts the vertices in a graph it contains two properties
- name of the vertex
- edge shared with other vertex
edges property in Node reprensents the adjacency graph which is implemented using a hash with vertex name as it key and edge weight as its value
Defined in:
graphlb/data_structures/nodes.crConstructors
- 
        .new(name : String)
        
          creats a graph whith no vertices and edges(empty-graph) 
Instance Method Summary
- 
        #!=(other : Node)
        
          Checks the wheather the two node are not equal 
- 
        #==(other : Node)
        
          Checks the wheather the two node are equal 
- 
        #add_edge(to_node, weight)
        
          Adds a new edge from the self to the to_node 
- 
        #edges : Hash(Graphlb::DataStructures::Node, Float64)
        
          A Hash to store the adjacency list of the vertex 
- 
        #name : String
        
          Name of the node, which is expexted to be unique for each vertex. 
- 
        #remove_edge(to_node)
        
          Removes an already existing edge from the graph 
Constructor Detail
Instance Method Detail
Checks the wheather the two node are not equal
@return : true if the two nodes are not equal, else false.
Checks the wheather the two node are equal
@return : true if the two nodes are equal, else false.
Adds a new edge from the self to the to_node
if to_node is not present in the greaph an exception is raised else an edge is created.
@param : to_node, the node where the edge ends,
@param : weight, the edge-weight,
@return : list of edges of the self node
A Hash to store the adjacency list of the vertex
Removes an already existing edge from the graph
if to_node is not present in the greaph an exception is raised else an edge is created.
@param : to_node, the node where the edge ends,
@return : list of edges of the self node