Node

A node (or node) in the graph.

Methods

MethodDescription
afterCreate a view of the Node including all events after start (exclusive).
atCreate a view of the Node including all events at time.
beforeCreate a view of the Node including all events before end (exclusive).
default_layerReturn a view of Node containing only the default edge layer
degreeGet the degree of this node (i.e., the number of edges that are incident to it).
edge_history_countGet the number of edge events for this node
exclude_layerReturn a view of Node containing all layers except the excluded name
exclude_layersReturn a view of Node containing all layers except the excluded names
exclude_valid_layerReturn a view of Node containing all layers except the excluded name
exclude_valid_layersReturn a view of Node containing all layers except the excluded names
expandingCreates a WindowSet with the given step size using an expanding window.
filterReturn a filtered view that only includes nodes and edges that satisfy the filter
has_layerCheck if Node has the layer "name"
in_degreeGet the in-degree of this node (i.e., the number of edges that are incident to it from other nodes).
is_activeCheck if the node is active (it's history is not empty).
latestCreate a view of the Node including all events at the latest time.
layerReturn a view of Node containing the layer "name"
layersReturn a view of Node containing all layers names
out_degreeGet the out-degree of this node (i.e., the number of edges that are incident to it from this node).
rollingCreates a WindowSet with the given window size and optional step using a rolling window.
shrink_endSet the end of the window to the smaller of end and self.end()
shrink_startSet the start of the window to the larger of start and self.start()
shrink_windowShrink both the start and end of the window (same as calling shrink_start followed by shrink_end but more efficient)
snapshot_atCreate a view of the Node including all events that have not been explicitly deleted at time.
snapshot_latestCreate a view of the Node including all events that have not been explicitly deleted at the latest time.
valid_layersReturn a view of Node containing all layers names
windowCreate a view of the Node including all events between start (inclusive) and end (exclusive)

Properties

PropertyDescription
earliest_timeReturns the earliest time that the node exists.
edgesGet the edges that are incident to this node.
endGets the latest time that this Node is valid.
historyReturns the history of a node, including node additions and changes made to node.
idReturns the id of the node.
in_edgesGet the edges that point into this node.
in_neighboursGet the neighbours of this node that point into this node.
latest_timeReturns the latest time that the node exists.
metadataThe metadata of the node
nameReturns the name of the node.
neighboursGet the neighbours of this node.
node_typeReturns the type of node
out_edgesGet the edges that point out of this node.
out_neighboursGet the neighbours of this node that point out of this node.
propertiesThe properties of the node
startGets the start time for rolling and expanding windows for this Node
window_sizeGet the window size (difference between start and end) for this Node.

Method Details

after

Signature: after(start)

Create a view of the Node including all events after start (exclusive).

Parameters

NameTypeDefaultDescription
startTimeInput-The start time of the window.

Returns

TypeDescription
Node

at

Signature: at(time)

Create a view of the Node including all events at time.

Parameters

NameTypeDefaultDescription
timeTimeInput-The time of the window.

Returns

TypeDescription
Node

before

Signature: before(end)

Create a view of the Node including all events before end (exclusive).

Parameters

NameTypeDefaultDescription
endTimeInput-The end time of the window.

Returns

TypeDescription
Node

default_layer

Return a view of Node containing only the default edge layer

Returns

TypeDescription
NodeThe layered view

degree

Get the degree of this node (i.e., the number of edges that are incident to it).

Returns

TypeDescription
intThe degree of this node.

edge_history_count

Get the number of edge events for this node

Returns

TypeDescription
intThe number of edge events

exclude_layer

Signature: exclude_layer(name)

Return a view of Node containing all layers except the excluded name Errors if any of the layers do not exist.

Parameters

NameTypeDefaultDescription
namestr-layer name that is excluded for the new view

Returns

TypeDescription
NodeThe layered view

exclude_layers

Signature: exclude_layers(names)

Return a view of Node containing all layers except the excluded names Errors if any of the layers do not exist.

Parameters

NameTypeDefaultDescription
nameslist[str]-list of layer names that are excluded for the new view

Returns

TypeDescription
NodeThe layered view

exclude_valid_layer

Signature: exclude_valid_layer(name)

Return a view of Node containing all layers except the excluded name

Parameters

NameTypeDefaultDescription
namestr-layer name that is excluded for the new view

Returns

TypeDescription
NodeThe layered view

exclude_valid_layers

Signature: exclude_valid_layers(names)

Return a view of Node containing all layers except the excluded names

Parameters

NameTypeDefaultDescription
nameslist[str]-list of layer names that are excluded for the new view

Returns

TypeDescription
NodeThe layered view

expanding

Signature: 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

NameTypeDefaultDescription
stepint | str-The step size of the window.
alignment_unitstr | None, optionalNoneIf 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.

Returns

TypeDescription
WindowSetA WindowSet object.

filter

Signature: filter(filter)

Return a filtered view that only includes nodes and edges that satisfy the filter

Parameters

NameTypeDefaultDescription
filterfilter.FilterExpr-The filter to apply to the nodes and edges.

Returns

TypeDescription
NodeThe filtered view

has_layer

Signature: has_layer(name)

Check if Node has the layer "name"

Parameters

NameTypeDefaultDescription
namestr-the name of the layer to check

Returns

TypeDescription
bool

in_degree

Get the in-degree of this node (i.e., the number of edges that are incident to it from other nodes).

Returns

TypeDescription
intThe in-degree of this node.

is_active

Check if the node is active (it's history is not empty).

Returns

TypeDescription
bool

latest

Create a view of the Node including all events at the latest time.

Returns

TypeDescription
Node

layer

Signature: layer(name)

Return a view of Node containing the layer "name" Errors if the layer does not exist

Parameters

NameTypeDefaultDescription
namestr-then name of the layer.

Returns

TypeDescription
NodeThe layered view

layers

Signature: layers(names)

Return a view of Node containing all layers names Errors if any of the layers do not exist.

Parameters

NameTypeDefaultDescription
nameslist[str]-list of layer names for the new view

Returns

TypeDescription
NodeThe layered view

out_degree

Get the out-degree of this node (i.e., the number of edges that are incident to it from this node).

Returns

TypeDescription
intThe out-degree of this node.

rolling

Signature: 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

NameTypeDefaultDescription
windowint | str-The size of the window.
stepint | str | None, optionalNoneThe step size of the window. step defaults to window.
alignment_unitstr | None, optionalNoneIf 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.

Returns

TypeDescription
WindowSetA WindowSet object.

shrink_end

Signature: shrink_end(end)

Set the end of the window to the smaller of end and self.end()

Parameters

NameTypeDefaultDescription
endTimeInput-the new end time of the window

Returns

TypeDescription
Node

shrink_start

Signature: shrink_start(start)

Set the start of the window to the larger of start and self.start()

Parameters

NameTypeDefaultDescription
startTimeInput-the new start time of the window

Returns

TypeDescription
Node

shrink_window

Signature: 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

NameTypeDefaultDescription
startTimeInput-the new start time for the window
endTimeInput-the new end time for the window

Returns

TypeDescription
Node

snapshot_at

Signature: snapshot_at(time)

Create a view of the Node including all events that have not been explicitly deleted at time.

This is equivalent to before(time + 1) for Graph and at(time) for PersistentGraph

Parameters

NameTypeDefaultDescription
timeTimeInput-The time of the window.

Returns

TypeDescription
Node

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

TypeDescription
Node

valid_layers

Signature: valid_layers(names)

Return a view of Node containing all layers names Any layers that do not exist are ignored

Parameters

NameTypeDefaultDescription
nameslist[str]-list of layer names for the new view

Returns

TypeDescription
NodeThe layered view

window

Signature: window(start, end)

Create a view of the Node including all events between start (inclusive) and end (exclusive)

Parameters

NameTypeDefaultDescription
startTimeInput-The start time of the window.
endTimeInput-The end time of the window.

Returns

TypeDescription
Node

Property Details

earliest_time

Returns the earliest time that the node exists.

Returns

TypeDescription
OptionalEventTimeThe earliest time that the node exists.

edges

Get the edges that are incident to this node.

Returns

TypeDescription
EdgesThe incident edges.

end

Gets the latest time that this Node is valid.

Returns

TypeDescription
OptionalEventTimeThe latest time that this Node is valid or None if the Node is valid for all times.

history

Returns the history of a node, including node additions and changes made to node.

Returns

TypeDescription
HistoryA History object for the node, providing access to time entries.

id

Returns the id of the node. This is a unique identifier for the node.

Returns

TypeDescription
(str | int)The id of the node.

in_edges

Get the edges that point into this node.

Returns

TypeDescription
EdgesThe inbound edges.

in_neighbours

Get the neighbours of this node that point into this node.

Returns

TypeDescription
PathFromNodeThe in-neighbours.

latest_time

Returns the latest time that the node exists.

Returns

TypeDescription
OptionalEventTimeThe latest time that the node exists.

metadata

The metadata of the node

Returns

TypeDescription
Metadata

name

Returns the name of the node.

Returns

TypeDescription
strThe id of the node as a string.

neighbours

Get the neighbours of this node.

Returns

TypeDescription
PathFromNodeThe neighbours (both inbound and outbound).

node_type

Returns the type of node

Returns

TypeDescription
str, optionalThe node type if it is set or None otherwise.

out_edges

Get the edges that point out of this node.

Returns

TypeDescription
EdgesThe outbound edges.

out_neighbours

Get the neighbours of this node that point out of this node.

Returns

TypeDescription
PathFromNodeThe out-neighbours.

properties

The properties of the node

Returns

TypeDescription
PropertiesA list of properties.

start

Gets the start time for rolling and expanding windows for this Node

Returns

TypeDescription
OptionalEventTimeThe earliest time that this Node is valid or None if the Node is valid for all times.

window_size

Get the window size (difference between start and end) for this Node.

Returns

TypeDescription
int, optional