Implements a directed graph.
| Legato. | Implements a directed graph. |
| Properties | |
| vertices | {Object} Name/{Legato.Graph.Vertex} map. |
| Functions | |
| initialize | Constructs a new directed graph. |
| getVertex | Returns: {Legato.Graph.Vertex} Existing vertex for the given name or null if no vertex found. |
| getOrCreateVertex | Returns: {Legato.Graph.Vertex} Either existing or a new vertex for the given name. |
| addEdge | Creates an edge between two vertices. |
| removeEdge | Removes an edge between two vertices. |
| clone | Clones the graph. |
| toArray | Performs the topological sorting of the given graph and returns the array of vertex names in the sorted order. |
{Object} Name/{Legato.Graph.Vertex} map.
getVertex : function( name )
Returns: {Legato.Graph.Vertex} Existing vertex for the given name or null if no vertex found.
| name | {String} name of the vertex. |
getOrCreateVertex : function( name )
Returns: {Legato.Graph.Vertex} Either existing or a new vertex for the given name.
| name | {String} name of the vertex. |
Constructs a new directed graph.
initialize : function()
Returns: {Legato.Graph.Vertex} Existing vertex for the given name or null if no vertex found.
getVertex : function( name )
Returns: {Legato.Graph.Vertex} Either existing or a new vertex for the given name.
getOrCreateVertex : function( name )
Creates an edge between two vertices.
addEdge : function( parentName, childName )
Removes an edge between two vertices.
removeEdge : function( parentName, childName )
Clones the graph.
clone : function()
Performs the topological sorting of the given graph and returns the array of vertex names in the sorted order.
toArray : function()