libSmalldb  v0.7-66-gb94d22a
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NestedGraph Class Reference

Inheritance diagram for NestedGraph

Public Member Functions

 getRootGraph ()
 
 getNodes ()
 Get all nodes in the graph. More...
 
 getEdges ()
 Get all edges in the graph. More...
 
 createNode (string $id, array $attrs)
 Create node and add it to the graph. More...
 
 addNode (Node $node)
 Add existing node to the graph. More...
 
 getNode (string $id)
 Get node by its ID. More...
 
 removeNode (Node $node)
 Remove node and connected edges from the graph. More...
 
 createEdge (string $id=null, Node $start, Node $end, array $attrs)
 Create a new edge and add it to the graph. More...
 
 addEdge (Edge $edge)
 Add existing edge to the graph. More...
 
 getEdge (string $id)
 Get Edge by its ID. More...
 
 removeEdge (Edge $edge)
 Remove edge from the graph and disconnect it from nodes. More...
 
 getParentNode ()
 
 nodeAttrChanged ($node, $key, $oldValue, $newValue)
 
 edgeAttrChanged ($node, $key, $oldValue, $newValue)
 

Protected Member Functions

 __construct (Node $parentNode=null)
 Constructor. More...
 

Protected Attributes

 $rootGraph
 Root graph. More...
 
 $nodeAttrIndex
 Node index. More...
 
 $edgeAttrIndex
 Edge index. More...
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Node  $parentNode = null)
protected

Constructor.

Member Function Documentation

◆ getNodes()

getNodes ( )

Get all nodes in the graph.

Returns
Node[]

◆ getEdges()

getEdges ( )

Get all edges in the graph.

Returns
Edge[]

◆ createNode()

createNode ( string  $id,
array  $attrs 
)

Create node and add it to the graph.

Parameters
string$id
array$attrs
Returns
Node

◆ addNode()

addNode ( Node  $node)

Add existing node to the graph.

Parameters
Node$node
Returns
NestedGraph

◆ getNode()

getNode ( string  $id)

Get node by its ID.

Parameters
string$id
Returns
Node

◆ removeNode()

removeNode ( Node  $node)

Remove node and connected edges from the graph.

Parameters
Node$node
Returns
NestedGraph

◆ createEdge()

createEdge ( string  $id = null,
Node  $start,
Node  $end,
array  $attrs 
)

Create a new edge and add it to the graph.

Parameters
string | null$idID of the edge, generated automatically if null.
array$attrsKey-value storage of the edge attributes.
Node$start
Node$end
Returns
Edge

◆ addEdge()

addEdge ( Edge  $edge)

Add existing edge to the graph.

Parameters
Edge$edge
Returns
NestedGraph

◆ getEdge()

getEdge ( string  $id)

Get Edge by its ID.

Parameters
string$id
Returns
Edge

◆ removeEdge()

removeEdge ( Edge  $edge)

Remove edge from the graph and disconnect it from nodes.

Parameters
Edge$edge
Returns
NestedGraph

◆ getParentNode()

getParentNode ( )
Returns
null|Node

Member Data Documentation

◆ $rootGraph

$rootGraph
protected

Root graph.

See also
Graph

◆ $nodeAttrIndex

$nodeAttrIndex
protected

Node index.

See also
ElementAttrIndex

◆ $edgeAttrIndex

$edgeAttrIndex
protected

Edge index.

See also
ElementAttrIndex