Node
#
Bases: object
A node (or node) in the graph.
earliest_time
property
#
Returns the earliest time that the node exists.
Returns:
| Type | Description |
|---|---|
OptionalEventTime
|
The earliest time that the node exists. |
edges
property
#
end
property
#
Gets the latest time that this Node is valid.
Returns:
| Type | Description |
|---|---|
OptionalEventTime
|
The latest time that this Node is valid or None if the Node is valid for all times. |
history
property
#
Returns the history of a node, including node additions and changes made to node.
Returns:
| Type | Description |
|---|---|
History
|
A History object for the node, providing access to time entries. |
id
property
#
in_edges
property
#
in_neighbours
property
#
Get the neighbours of this node that point into this node.
Returns:
| Type | Description |
|---|---|
PathFromNode
|
The in-neighbours. |
latest_time
property
#
Returns the latest time that the node exists.
Returns:
| Type | Description |
|---|---|
OptionalEventTime
|
The latest time that the node exists. |
name
property
#
neighbours
property
#
Get the neighbours of this node.
Returns:
| Type | Description |
|---|---|
PathFromNode
|
The neighbours (both inbound and outbound). |
node_type
property
#
Returns the type of node
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The node type if it is set or |
out_edges
property
#
out_neighbours
property
#
Get the neighbours of this node that point out of this node.
Returns:
| Type | Description |
|---|---|
PathFromNode
|
The out-neighbours. |
properties
property
#
start
property
#
Gets the start time for rolling and expanding windows for this Node
Returns:
| Type | Description |
|---|---|
OptionalEventTime
|
The earliest time that this Node is valid or None if the Node is valid for all times. |
window_size
property
#
Get the window size (difference between start and end) for this Node.
Returns:
| Type | Description |
|---|---|
Optional[int]
|
|
__eq__(value)
#
Return self==value.
__ge__(value)
#
Return self>=value.
__getitem__(key)
#
Return self[key].
__gt__(value)
#
Return self>value.
__hash__()
#
Return hash(self).
__le__(value)
#
Return self<=value.
__lt__(value)
#
Return self<value.
__ne__(value)
#
Return self!=value.
__repr__()
#
Return repr(self).
after(start)
#
at(time)
#
before(end)
#
default_layer()
#
Return a view of Node containing only the default edge layer Returns: Node: The layered view
degree()
#
Get the degree of this node (i.e., the number of edges that are incident to it).
Returns:
| Type | Description |
|---|---|
int
|
The degree of this node. |
edge_history_count()
#
exclude_layer(name)
#
exclude_layers(names)
#
exclude_valid_layer(name)
#
Return a view of Node containing all layers except the excluded name
Arguments:
name (str): layer name that is excluded for the new view
Returns:
| Type | Description |
|---|---|
Node
|
The layered view |
exclude_valid_layers(names)
#
Return a view of Node containing all layers except the excluded names
Arguments:
names (list[str]): list of layer names that are excluded for the new view
Returns:
| Type | Description |
|---|---|
Node
|
The layered view |
expanding(step, alignment_unit=None)
#
Creates a WindowSet with the given step size using an expanding window.
An expanding window is a window that grows by step size at each iteration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int | str
|
The step size of the window. |
required |
alignment_unit
|
str | None
|
If no alignment_unit is passed, aligns the start of the first window to the smallest unit of time passed to step. For example, if the step is "1 month and 1 day", the windows will be aligned on days (00:00:00 to 23:59:59). If set to "unaligned", the first window will begin at the first time event. If any other alignment unit is passed, the windows will be aligned to that unit. alignment_unit defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
WindowSet
|
A |
filter(filter)
#
Return a filtered view that only includes nodes and edges that satisfy the filter
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter
|
FilterExpr
|
The filter to apply to the nodes and edges. |
required |
Returns:
| Type | Description |
|---|---|
Node
|
The filtered view |
has_layer(name)
#
in_degree()
#
Get the in-degree of this node (i.e., the number of edges that are incident to it from other nodes).
Returns:
| Type | Description |
|---|---|
int
|
The in-degree of this node. |
is_active()
#
latest()
#
layer(name)
#
layers(names)
#
out_degree()
#
Get the out-degree of this node (i.e., the number of edges that are incident to it from this node).
Returns:
| Type | Description |
|---|---|
int
|
The out-degree of this node. |
rolling(window, step=None, alignment_unit=None)
#
Creates a WindowSet with the given window size and optional step using a rolling window.
If alignment_unit is not "unaligned" and a step larger than window is provided, some time entries
may appear before the start of the first window and/or after the end of the last window (i.e. not included in any window).
A rolling window is a window that moves forward by step size at each iteration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
int | str
|
The size of the window. |
required |
step
|
int | str | None
|
The step size of the window.
|
None
|
alignment_unit
|
str | None
|
If no alignment_unit is passed, aligns the start of the first window to the smallest unit of time passed to step (or window if no step is passed). For example, if the step is "1 month and 1 day", the first window will begin at the start of the day of the first time event. If set to "unaligned", the first window will begin at the first time event. If any other alignment unit is passed, the windows will be aligned to that unit. alignment_unit defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
WindowSet
|
A |
shrink_end(end)
#
Set the end of the window to the smaller of end and self.end()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
end
|
TimeInput
|
the new end time of the window |
required |
Returns: Node:
shrink_start(start)
#
shrink_window(start, end)
#
Shrink both the start and end of the window (same as calling shrink_start followed by shrink_end but more efficient)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
TimeInput
|
the new start time for the window |
required |
end
|
TimeInput
|
the new end time for the window |
required |
Returns:
| Type | Description |
|---|---|
Node
|
|
snapshot_at(time)
#
snapshot_latest()
#
Create a view of the Node including all events that have not been explicitly deleted at the latest time.
This is equivalent to a no-op for Graph and latest() for PersistentGraph
Returns:
| Type | Description |
|---|---|
Node
|
|