Constructor
new GraphSpreading(spreadGraph)
import { GraphSpreading } from 'ancient-graph-spreading';
Parameters:
Name | Type | Description |
---|---|---|
spreadGraph |
SpreadGraph |
- Source:
Methods
_getFromFields(pathGraphopt, pathLinkopt, spreadLinkopt) → {Array.<String>}
Custom getter of possible from fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pathGraph |
Object |
<optional> |
|
pathLink |
Object |
<optional> |
|
spreadLink |
Object |
<optional> |
- Source:
Returns:
[fromFields]
- Type
- Array.<String>
_getToFields(pathGraphopt, pathLinkopt, spreadLinkopt) → {Array.<String>}
Custom getter of possible to fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pathGraph |
Object |
<optional> |
|
pathLink |
Object |
<optional> |
|
spreadLink |
Object |
<optional> |
- Source:
Returns:
[toFields]
- Type
- Array.<String>
_spreadByPathLink(fromField, pathGraph, pathLink, contextopt, handleropt, callbackopt)
Spread by pathLink and specified fromField with available spreadLinks.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fromField |
string | ||
pathGraph |
PathGraph | ||
pathLink |
PathLink | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~spreadFromSpreadLinkByPathLinkCallback |
<optional> |
|
callback |
GraphSpreading~spreadByPathLinkCallback |
<optional> |
- Source:
_spreadFromSpreadLinkByPathGraph(fromField, spreadLink, pathGraph, contextopt, handleropt, callbackopt)
Spread by all available paths in pathGraph from spreadLink and specified fromField.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fromField |
string | ||
spreadLink |
SpreadLink | ||
pathGraph |
PathGraph | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~spreadFromSpreadLinkByPathGraphHandler |
<optional> |
|
callback |
GraphSpreading~spreadFromSpreadLinkByPathGraphCallback |
<optional> |
- Source:
_spreadFromSpreadLinkByPathLink(spreadLink, pathGraph, pathLink, contextopt, callbackopt)
Spread by pathLink and specified toField in pathGraph from spreadLink.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
spreadLink |
SpreadLink | ||
pathGraph |
PathGraph | ||
pathLink |
PathLink | ||
context |
Object |
<optional> |
|
callback |
GraphSpreading~spreadFromSpreadLinkByPathLinkCallback |
<optional> |
- Source:
_wrapPathQuery(queryopt, pathGraphopt, fromFieldopt, toFieldopt, contextopt)
Custom wrapper of query to path graph
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
Object |
<optional> |
|
pathGraph |
Object |
<optional> |
|
fromField |
String |
<optional> |
|
toField |
String |
<optional> |
|
context |
Object |
<optional> |
- Source:
_wrapSpreadQuery(queryopt, contextopt)
Custom wrapper of query to spread graph
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
Object |
<optional> |
|
context |
Object |
<optional> |
- Source:
addPathGraph(pathGraph)
Parameters:
Name | Type | Description |
---|---|---|
pathGraph |
PathGraph |
- Source:
each(coll, iteratee, callback)
Custom async callbacks support
Parameters:
Name | Type | Description |
---|---|---|
coll |
Array | Iterable | Object | A collection to iterate over. |
iteratee |
function | A function to apply to each item in coll. |
callback |
function | A callback which is called when all iteratee functions have finished. |
- Source:
spreadByPathLink(pathGraph, pathLink, contextopt, handleropt, callbackopt)
Spread by pathLink with available spreadLinks.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pathGraph |
PathGraph | ||
pathLink |
PathLink | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~spreadFromSpreadLinkByPathLinkCallback |
<optional> |
|
callback |
GraphSpreading~spreadByPathLinkCallback |
<optional> |
- Source:
spreadFromSpreadLink(spreadLink, contextopt, handleropt, callbackopt)
Spread by all available paths from spreadLink.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
spreadLink |
SpreadLink | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~spreadFromSpreadLinkByPathGraphHandler |
<optional> |
|
callback |
GraphSpreading~spreadFromSpreadLinkByPathGraphCallback |
<optional> |
- Source:
spreadFromSpreadLinkByPathGraph(spreadLink, pathGraph, handleropt, callbackopt)
Spread by all available paths in pathGraph from spreadLink.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
spreadLink |
SpreadLink | ||
pathGraph |
PathGraph | ||
handler |
GraphSpreading~spreadFromSpreadLinkByPathGraphHandler |
<optional> |
|
callback |
GraphSpreading~spreadFromSpreadLinkByPathGraphCallback |
<optional> |
- Source:
spreadFromSpreadLinkByPathLink(spreadLink, pathGraph, pathLink, contextopt, handleropt, callbackopt)
Spread by pathLink in pathGraph from spreadLink.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
spreadLink |
SpreadLink | ||
pathGraph |
PathGraph | ||
pathLink |
PathLink | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~spreadFromSpreadLinkByPathLinkHandler |
<optional> |
|
callback |
GraphSpreading~spreadFromSpreadLinkByPathLinkCallback |
<optional> |
- Source:
spreadNewSpreadLink(newSpreadLink, contextopt, callbackopt)
Spread root of tree spreadLink.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newSpreadLink |
SpreadLink | ||
context |
Object |
<optional> |
|
callback |
Graph~insertCallback |
<optional> |
- Source:
spreadTo(id, contextopt, handleropt, callbackopt)
Spread all spread links from all available paths to this id.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~spreadToHandler |
<optional> |
|
callback |
GraphSpreading~spreadToCallback |
<optional> |
- Source:
unspread(id, contextopt, handleropt, callbackopt)
Unspread all valid spreadLinks to this id.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~unspreadToHandler |
<optional> |
|
callback |
GraphSpreading~unspreadToCallback |
<optional> |
- Source:
unspreadByPathId(pathLinkId, contextopt, handleropt, callbackopt)
Remove spreadLinks with specific path pathLink id.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pathLinkId |
string | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~unspreadByPathIdHandler |
<optional> |
|
callback |
GraphSpreading~unspreadByPathIdCallback |
<optional> |
- Source:
unspreadFromRemovedSpreadLinkByPrevId(spreadLinkId, contextopt, handleropt, callbackopt)
Remove spreadLinks with specific prev spreadLink id.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
spreadLinkId |
string | ||
context |
Object |
<optional> |
|
handler |
GraphSpreading~unspreadFromRemovedSpreadLinkByPrevIdHandler |
<optional> |
|
callback |
GraphSpreading~unspreadFromRemovedSpreadLinkByPrevIdCallback |
<optional> |
- Source:
Type Definitions
spreadByPathLinkCallback()
Optional callback.
- Source:
spreadFromSpreadLinkByPathGraphCallback()
Optional callback.
- Source:
spreadFromSpreadLinkByPathGraphHandler(erroropt, newSpreadLinkIdopt, prevSpreadLinkopt, pathGraphopt, pathLinkopt)
Optional handler. If present, called with an error object as the first argument and, if no error, others arguments with results of spreading.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
newSpreadLinkId |
string |
<optional> |
|
prevSpreadLink |
SpreadLink |
<optional> |
|
pathGraph |
PathGraph |
<optional> |
|
pathLink |
PathLink |
<optional> |
- Source:
spreadFromSpreadLinkByPathLinkCallback(erroropt, newSpreadLinkIdopt, prevSpreadLinkopt, pathGraphopt, pathLinkopt)
Optional handler.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
newSpreadLinkId |
string |
<optional> |
|
prevSpreadLink |
SpreadLink |
<optional> |
|
pathGraph |
PathGraph |
<optional> |
|
pathLink |
PathLink |
<optional> |
- Source:
spreadFromSpreadLinkByPathLinkCallback()
Optional callback. If present, called with an error object as the first argument and, if no error, the unique id of inserted spread link as the second.
- Source:
spreadToCallback()
Optional callback.
- Source:
spreadToHandler(erroropt, newSpreadLinkIdopt, prevSpreadLinkopt, pathGraphopt, pathLinkopt)
Optional handler. Fires after each processed spread link.
Id can be empty if the this.spreadGraph._spreadingHandler
banned spreading.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
newSpreadLinkId |
string |
<optional> |
|
prevSpreadLink |
SpreadLink |
<optional> |
|
pathGraph |
PathGraph |
<optional> |
|
pathLink |
PathLink |
<optional> |
- Source:
unspreadByPathIdCallback(erroropt, countopt)
Optional callback.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
count |
number |
<optional> |
- Source:
unspreadByPathIdHandler(erroropt, spreadLinkopt)
Optional handler.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
spreadLink |
SpreadLink |
<optional> |
- Source:
unspreadFromRemovedSpreadLinkByPrevIdCallback(erroropt, countopt)
Optional callback.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
count |
number |
<optional> |
- Source:
unspreadFromRemovedSpreadLinkByPrevIdHandler(erroropt, spreadLinkopt)
Optional handler. If present, called with an error object as the first argument and, if no error, others arguments with results of unspreading.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
spreadLink |
SpreadLink |
<optional> |
- Source:
unspreadToCallback()
Optional callback.
- Source:
unspreadToHandler(erroropt, spreadLinkopt)
Optional handler.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
Error |
<optional> |
|
spreadLink |
SpreadLink |
<optional> |
- Source: