Package visgraph :: Module dbcore :: Class DbSubGraph
[hide private]
[frames] | no frames]

Class DbSubGraph

source code


A subgraph in the database is basically a forward cached instance of selected nodes and edges in an in-memory graph (visgraph.graphcore.Graph). This object may then be used for traditional path tracing without going back to the database.

Any modifications to graph element properties *will* be synchronized back to the database backing the given subgraph.

Instance Methods [hide private]
 
__init__(self, dbinfo) source code
 
addNode(self, nodeid=None, ninfo=None, **kwargs)
Add a Node object to the graph.
source code
 
addEdge(self, fromid, toid, einfo)
Add an edge to the graph.
source code
 
useEdges(self, **kwargs)
Pull some edges from the DbStore backing this subgraph into the actual visgraph.graphcore.Graph instance so path traversal is possible.
source code
 
expandNode(self, nid, maxdepth=1)
Add *all* the edges (and adjacent nodes) by traversing this nodes edges to the specified depth...
source code

Inherited from DbGraphStore: buildSubGraph, delEdge, delNode, delNodeInfo, getEdge, getEdgeInfo, getEdgeProps, getNodeInfo, getNodeProps, getNodesProps, getRefsFrom, getRefsFromBulk, getRefsTo, getRefsToBulk, searchNodes, setEdgeInfo, setNodeInfo

Inherited from graphcore.Graph: getClusterGraphs, getEdges, getMeta, getNode, getNodeCount, getNodes, hasEdge, hasNode, pathSearch, pathSearchFrom, pathSearchOne, setMeta, wipeGraph

Method Details [hide private]

__init__(self, dbinfo)
(Constructor)

source code 
Overrides: graphcore.Graph.__init__

addNode(self, nodeid=None, ninfo=None, **kwargs)

source code 

Add a Node object to the graph.  Returns the nodeid.

Example: nid = g.addNode()
         g.addNode('woot', {'height':20, 'width':20})

NOTE: If nodeid is unspecified, it is considered an 'anonymous'
      node and will have an ID automagically assigned.

Overrides: graphcore.Graph.addNode
(inherited documentation)

addEdge(self, fromid, toid, einfo)

source code 

Add an edge to the graph. Edges are directional.

Example: g.addEdge(node_1, node_2, einfo={'name':'Woot Edge'})

Overrides: graphcore.Graph.addEdge
(inherited documentation)