Node#

class raphtory.Node#

Bases: object

A node (or node) in the graph.

Methods:

after(start)

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

at(time)

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

before(end)

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

default_layer()

Return a view of Node containing only the default edge layer :returns: The layered view :rtype: Node

degree()

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

exclude_layer(name)

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

exclude_layers(names)

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

exclude_valid_layer(name)

Return a view of Node containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

exclude_valid_layers(names)

Return a view of Node containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

expanding(step)

Creates a WindowSet with the given step size using an expanding window.

has_layer(name)

Check if Node has the layer "name"

history()

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

history_date_time()

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

in_degree()

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

layer(name)

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

layers(names)

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

out_degree()

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

rolling(window[, step])

Creates a WindowSet with the given window size and optional step using a rolling window.

shrink_end(end)

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

shrink_start(start)

Set the start of the window to the larger of start and self.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)

valid_layers(names)

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

window(start, end)

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

Attributes:

earliest_date_time

Returns the earliest datetime that the node exists.

earliest_time

Returns the earliest time that the node exists.

edges

Get the edges that are incident to this node.

end

Gets the latest time that this Node is valid.

end_date_time

Gets the latest datetime that this Node is valid

id

Returns the id of the node.

in_edges

Get the edges that point into this node.

in_neighbours

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

latest_date_time

Returns the latest datetime that the node exists.

latest_time

Returns the latest time that the node exists.

name

Returns the name of the node.

neighbours

Get the neighbours of this node.

node_type

Returns the type of node

out_edges

Get the edges that point out of this node.

out_neighbours

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

properties

The properties of the node

start

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

start_date_time

Gets the earliest datetime that this Node is valid

window_size

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

after(start)#

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

Parameters:

start (int | DateTime | str) – The start time of the window.

Returns:

A Node object.

at(time)#

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

Parameters:

time (int | DateTime | str) – The time of the window.

Returns:

A Node object.

before(end)#

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

Parameters:

end (int | DateTime | str) – The end time of the window.

Returns:

A Node object.

default_layer()#

Return a view of Node containing only the default edge layer :returns: The layered view :rtype: Node

degree()#

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

Returns

The degree of this node.

earliest_date_time#

Returns the earliest datetime that the node exists.

Returns:

The earliest datetime that the node exists as an integer.

earliest_time#

Returns the earliest time that the node exists.

Returns:

The earliest time that the node exists as an integer.

edges#

Get the edges that are incident to this node.

Returns:

An iterator over the edges that are incident to this node.

end#

Gets the latest time that this Node is valid.

Returns:

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

end_date_time#

Gets the latest datetime that this Node is valid

Returns:

The latest datetime that this Node is valid or None if the Node is valid for all times.

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:

name (str) – layer name that is excluded for the new view

Returns:

The layered view

Return type:

Node

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:

names (list[str]) – list of layer names that are excluded for the new view

Returns:

The layered view

Return type:

Node

exclude_valid_layer(name)#

Return a view of Node containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

Returns:

The layered view

Return type:

Node

exclude_valid_layers(names)#

Return a view of Node containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

Returns:

The layered view

Return type:

Node

expanding(step)#

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:

step (int | str) – The step size of the window.

Returns:

A WindowSet object.

has_layer(name)#

Check if Node has the layer “name”

history()#

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

Returns:

A list of unix timestamps of the event history of node.

history_date_time()#

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

Returns:

A list of timestamps of the event history of node.

id#

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

Returns:

The id of the node as an integer.

in_degree()#

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

Returns:

The in-degree of this node.

in_edges#

Get the edges that point into this node.

Returns:

An iterator over the edges that point into this node.

in_neighbours#

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

Returns:

An iterator over the neighbours of this node that point into this node.

latest_date_time#

Returns the latest datetime that the node exists.

Parameters:

None

Returns:

The latest datetime that the node exists as an integer.

latest_time#

Returns the latest time that the node exists.

Returns:

The latest time that the node exists as an integer.

layer(name)#

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

Returns:

The layered view

Return type:

Node

layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

Node

name#

Returns the name of the node.

Returns:

The name of the node as a string.

neighbours#

Get the neighbours of this node.

Returns:

An iterator over the neighbours of this node.

node_type#

Returns the type of node

out_degree()#

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

Returns:

The out-degree of this node.

out_edges#

Get the edges that point out of this node.

Returns:

An iterator over the edges that point out of this node.

out_neighbours#

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

Returns:

An iterator over the neighbours of this node that point out of this node.

properties#

The properties of the node

Returns:

A list of properties.

rolling(window, step=None)#

Creates a WindowSet with the given window size and optional step using a rolling window.

A rolling window is a window that moves forward by step size at each iteration.

Parameters:
  • window (int | str) – The size of the window.

  • step (int | str | None) – The step size of the window. Defaults to window.

Returns:

A WindowSet object.

shrink_end(end)#

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

Parameters:

end (int | DateTime | str) – the new end time of the window

Returns:

A Node object.

shrink_start(start)#

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

Parameters:

start (int | DateTime | str) – the new start time of the window

Returns:

A Node object.

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)

Arguments:

start#

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

Returns:

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

start_date_time#

Gets the earliest datetime that this Node is valid

Returns:

The earliest datetime that this Node is valid or None if the Node is valid for all times.

valid_layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

Node

window(start, end)#

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

Parameters:
  • start (int | DateTime | str | None) – The start time of the window (unbounded if None).

  • end (int | DateTime | str | None) – The end time of the window (unbounded if None).

Returns: r A Node object.

window_size#

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

class raphtory.Nodes#

Bases: object

A list of nodes that can be iterated over.

Methods:

after(start)

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

at(time)

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

before(end)

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

collect()

Collect all nodes into a list

default_layer()

Return a view of Nodes containing only the default edge layer :returns: The layered view :rtype: Nodes

degree()

Returns the number of edges of the nodes

exclude_layer(name)

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

exclude_layers(names)

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

exclude_valid_layer(name)

Return a view of Nodes containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

exclude_valid_layers(names)

Return a view of Nodes containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

expanding(step)

Creates a WindowSet with the given step size using an expanding window.

has_layer(name)

Check if Nodes has the layer "name"

history()

Returns all timestamps of nodes, when an node is added or change to an node is made.

history_date_time()

Returns all timestamps of nodes, when an node is added or change to an node is made.

in_degree()

Returns the number of in edges of the nodes

layer(name)

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

layers(names)

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

out_degree()

Returns the number of out edges of the nodes

rolling(window[, step])

Creates a WindowSet with the given window size and optional step using a rolling window.

shrink_end(end)

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

shrink_start(start)

Set the start of the window to the larger of start and self.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)

to_df([include_property_history, ...])

Converts the graph's nodes into a Pandas DataFrame.

type_filter(node_types)

valid_layers(names)

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

window(start, end)

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

Attributes:

earliest_date_time

Returns the earliest time of the nodes.

earliest_time

Returns an iterator over the nodes earliest time

edges

Get the edges that are incident to this node.

end

Gets the latest time that this Nodes is valid.

end_date_time

Gets the latest datetime that this Nodes is valid

id

Returns an iterator over the nodes ids

in_edges

Get the edges that point into this node.

in_neighbours

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

latest_date_time

Returns the latest date time of the nodes.

latest_time

Returns an iterator over the nodes latest time

name

Returns an iterator over the nodes name

neighbours

Get the neighbours of this node.

node_type

Returns the type of node

out_edges

Get the edges that point out of this node.

out_neighbours

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

properties

The properties of the node

start

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

start_date_time

Gets the earliest datetime that this Nodes is valid

window_size

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

after(start)#

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

Parameters:

start (int | DateTime | str) – The start time of the window.

Returns:

A Nodes object.

at(time)#

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

Parameters:

time (int | DateTime | str) – The time of the window.

Returns:

A Nodes object.

before(end)#

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

Parameters:

end (int | DateTime | str) – The end time of the window.

Returns:

A Nodes object.

collect()#

Collect all nodes into a list

Returns:

the list of nodes

Return type:

list[Node]

default_layer()#

Return a view of Nodes containing only the default edge layer :returns: The layered view :rtype: Nodes

degree()#

Returns the number of edges of the nodes

Returns:

An iterator of the number of edges of the nodes

earliest_date_time#

Returns the earliest time of the nodes.

Returns: Earliest time of the nodes.

earliest_time#

Returns an iterator over the nodes earliest time

edges#

Get the edges that are incident to this node.

Returns:

An iterator over the edges that are incident to this node.

end#

Gets the latest time that this Nodes is valid.

Returns:

The latest time that this Nodes is valid or None if the Nodes is valid for all times.

end_date_time#

Gets the latest datetime that this Nodes is valid

Returns:

The latest datetime that this Nodes is valid or None if the Nodes is valid for all times.

exclude_layer(name)#

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

Parameters:

name (str) – layer name that is excluded for the new view

Returns:

The layered view

Return type:

Nodes

exclude_layers(names)#

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

Parameters:

names (list[str]) – list of layer names that are excluded for the new view

Returns:

The layered view

Return type:

Nodes

exclude_valid_layer(name)#

Return a view of Nodes containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

Returns:

The layered view

Return type:

Nodes

exclude_valid_layers(names)#

Return a view of Nodes containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

Returns:

The layered view

Return type:

Nodes

expanding(step)#

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:

step (int | str) – The step size of the window.

Returns:

A WindowSet object.

has_layer(name)#

Check if Nodes has the layer “name”

history()#

Returns all timestamps of nodes, when an node is added or change to an node is made.

Returns:

A list of unix timestamps.

history_date_time()#

Returns all timestamps of nodes, when an node is added or change to an node is made.

Returns:

An list of timestamps.

id#

Returns an iterator over the nodes ids

in_degree()#

Returns the number of in edges of the nodes

Returns:

An iterator of the number of in edges of the nodes

in_edges#

Get the edges that point into this node.

Returns:

An iterator over the edges that point into this node.

in_neighbours#

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

Returns:

An iterator over the neighbours of this node that point into this node.

latest_date_time#

Returns the latest date time of the nodes.

Returns:

Latest date time of the nodes.

latest_time#

Returns an iterator over the nodes latest time

layer(name)#

Return a view of Nodes containing the layer “name” Errors if the layer does not exist

Returns:

The layered view

Return type:

Nodes

layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

Nodes

name#

Returns an iterator over the nodes name

neighbours#

Get the neighbours of this node.

Returns:

An iterator over the neighbours of this node.

node_type#

Returns the type of node

out_degree()#

Returns the number of out edges of the nodes

Returns:

An iterator of the number of out edges of the nodes

out_edges#

Get the edges that point out of this node.

Returns:

An iterator over the edges that point out of this node.

out_neighbours#

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

Returns:

An iterator over the neighbours of this node that point out of this node.

properties#

The properties of the node

Returns:

A List of properties

rolling(window, step=None)#

Creates a WindowSet with the given window size and optional step using a rolling window.

A rolling window is a window that moves forward by step size at each iteration.

Parameters:
  • window (int | str) – The size of the window.

  • step (int | str | None) – The step size of the window. Defaults to window.

Returns:

A WindowSet object.

shrink_end(end)#

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

Parameters:

end (int | DateTime | str) – the new end time of the window

Returns:

A Nodes object.

shrink_start(start)#

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

Parameters:

start (int | DateTime | str) – the new start time of the window

Returns:

A Nodes object.

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)

Arguments:

start#

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

Returns:

The earliest time that this Nodes is valid or None if the Nodes is valid for all times.

start_date_time#

Gets the earliest datetime that this Nodes is valid

Returns:

The earliest datetime that this Nodes is valid or None if the Nodes is valid for all times.

to_df(include_property_history=False, convert_datetime=False)#

Converts the graph’s nodes into a Pandas DataFrame.

This method will create a DataFrame with the following columns: - “name”: The name of the node. - “properties”: The properties of the node. - “update_history”: The update history of the node.

Parameters:
  • include_property_history (bool) – A boolean, if set to true, the history of each property is included, if false, only the latest value is shown.

  • convert_datetime (bool) – A boolean, if set to true will convert the timestamp to python datetimes, defaults to false

Returns:

If successful, this PyObject will be a Pandas DataFrame.

type_filter(node_types)#
valid_layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

Nodes

window(start, end)#

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

Parameters:
  • start (int | DateTime | str | None) – The start time of the window (unbounded if None).

  • end (int | DateTime | str | None) – The end time of the window (unbounded if None).

Returns: r A Nodes object.

window_size#

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

class raphtory.MutableNode#

Bases: Node

Methods:

add_constant_properties(properties)

Add constant properties to a node in the graph.

add_updates(t[, properties])

Add updates to a node in the graph at a specified time.

after(start)

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

at(time)

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

before(end)

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

default_layer()

Return a view of Node containing only the default edge layer :returns: The layered view :rtype: Node

degree()

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

exclude_layer(name)

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

exclude_layers(names)

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

exclude_valid_layer(name)

Return a view of Node containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

exclude_valid_layers(names)

Return a view of Node containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

expanding(step)

Creates a WindowSet with the given step size using an expanding window.

has_layer(name)

Check if Node has the layer "name"

history()

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

history_date_time()

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

in_degree()

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

layer(name)

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

layers(names)

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

out_degree()

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

rolling(window[, step])

Creates a WindowSet with the given window size and optional step using a rolling window.

set_node_type(new_type)

Set the type on the node.

shrink_end(end)

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

shrink_start(start)

Set the start of the window to the larger of start and self.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)

update_constant_properties(properties)

Update constant properties of a node in the graph overwriting existing values.

valid_layers(names)

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

window(start, end)

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

Attributes:

earliest_date_time

Returns the earliest datetime that the node exists.

earliest_time

Returns the earliest time that the node exists.

edges

Get the edges that are incident to this node.

end

Gets the latest time that this Node is valid.

end_date_time

Gets the latest datetime that this Node is valid

id

Returns the id of the node.

in_edges

Get the edges that point into this node.

in_neighbours

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

latest_date_time

Returns the latest datetime that the node exists.

latest_time

Returns the latest time that the node exists.

name

Returns the name of the node.

neighbours

Get the neighbours of this node.

node_type

Returns the type of node

out_edges

Get the edges that point out of this node.

out_neighbours

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

properties

The properties of the node

start

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

start_date_time

Gets the earliest datetime that this Node is valid

window_size

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

add_constant_properties(properties)#

Add constant properties to a node in the graph. This function is used to add properties to a node that remain constant and do not change over time. These properties are fundamental attributes of the node.

Parameters:
  • properties (Dict[str, Prop]) – A dictionary of properties to be added to the node.

  • name (Each key is a string representing the property)

  • Prop (and each value is of type)

  • value. (representing the property)

Returns:

A result object indicating success or failure. On failure, it contains a GraphError.

Return type:

Result

add_updates(t, properties=None)#

Add updates to a node in the graph at a specified time. This function allows for the addition of property updates to a node within the graph. The updates are time-stamped, meaning they are applied at the specified time.

Parameters:
  • t (PyTime) – The timestamp at which the updates should be applied.

  • properties (Optional[Dict[str, Prop]]) – A dictionary of properties to update. Each key is a string representing the property name, and each value is of type Prop representing the property value. If None, no properties are updated.

Returns:

A result object indicating success or failure. On failure, it contains a GraphError.

Return type:

Result

after(start)#

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

Parameters:

start (int | DateTime | str) – The start time of the window.

Returns:

A Node object.

at(time)#

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

Parameters:

time (int | DateTime | str) – The time of the window.

Returns:

A Node object.

before(end)#

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

Parameters:

end (int | DateTime | str) – The end time of the window.

Returns:

A Node object.

default_layer()#

Return a view of Node containing only the default edge layer :returns: The layered view :rtype: Node

degree()#

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

Returns

The degree of this node.

earliest_date_time#

Returns the earliest datetime that the node exists.

Returns:

The earliest datetime that the node exists as an integer.

earliest_time#

Returns the earliest time that the node exists.

Returns:

The earliest time that the node exists as an integer.

edges#

Get the edges that are incident to this node.

Returns:

An iterator over the edges that are incident to this node.

end#

Gets the latest time that this Node is valid.

Returns:

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

end_date_time#

Gets the latest datetime that this Node is valid

Returns:

The latest datetime that this Node is valid or None if the Node is valid for all times.

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:

name (str) – layer name that is excluded for the new view

Returns:

The layered view

Return type:

Node

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:

names (list[str]) – list of layer names that are excluded for the new view

Returns:

The layered view

Return type:

Node

exclude_valid_layer(name)#

Return a view of Node containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

Returns:

The layered view

Return type:

Node

exclude_valid_layers(names)#

Return a view of Node containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

Returns:

The layered view

Return type:

Node

expanding(step)#

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:

step (int | str) – The step size of the window.

Returns:

A WindowSet object.

has_layer(name)#

Check if Node has the layer “name”

history()#

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

Returns:

A list of unix timestamps of the event history of node.

history_date_time()#

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

Returns:

A list of timestamps of the event history of node.

id#

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

Returns:

The id of the node as an integer.

in_degree()#

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

Returns:

The in-degree of this node.

in_edges#

Get the edges that point into this node.

Returns:

An iterator over the edges that point into this node.

in_neighbours#

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

Returns:

An iterator over the neighbours of this node that point into this node.

latest_date_time#

Returns the latest datetime that the node exists.

Parameters:

None

Returns:

The latest datetime that the node exists as an integer.

latest_time#

Returns the latest time that the node exists.

Returns:

The latest time that the node exists as an integer.

layer(name)#

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

Returns:

The layered view

Return type:

Node

layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

Node

name#

Returns the name of the node.

Returns:

The name of the node as a string.

neighbours#

Get the neighbours of this node.

Returns:

An iterator over the neighbours of this node.

node_type#

Returns the type of node

out_degree()#

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

Returns:

The out-degree of this node.

out_edges#

Get the edges that point out of this node.

Returns:

An iterator over the edges that point out of this node.

out_neighbours#

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

Returns:

An iterator over the neighbours of this node that point out of this node.

properties#

The properties of the node

Returns:

A list of properties.

rolling(window, step=None)#

Creates a WindowSet with the given window size and optional step using a rolling window.

A rolling window is a window that moves forward by step size at each iteration.

Parameters:
  • window (int | str) – The size of the window.

  • step (int | str | None) – The step size of the window. Defaults to window.

Returns:

A WindowSet object.

set_node_type(new_type)#

Set the type on the node. This only works if the type has not been previously set, otherwise will throw an error

Parameters:

new_type (str) – The new type to be set

Returns:

A result object indicating success or failure. On failure, it contains a GraphError.

Return type:

Result

shrink_end(end)#

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

Parameters:

end (int | DateTime | str) – the new end time of the window

Returns:

A Node object.

shrink_start(start)#

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

Parameters:

start (int | DateTime | str) – the new start time of the window

Returns:

A Node object.

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)

Arguments:

start#

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

Returns:

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

start_date_time#

Gets the earliest datetime that this Node is valid

Returns:

The earliest datetime that this Node is valid or None if the Node is valid for all times.

update_constant_properties(properties)#

Update constant properties of a node in the graph overwriting existing values. This function is used to add properties to a node that remain constant and do not change over time. These properties are fundamental attributes of the node.

Parameters:
  • properties (Dict[str, Prop]) – A dictionary of properties to be added to the node.

  • name (Each key is a string representing the property)

  • Prop (and each value is of type)

  • value. (representing the property)

Returns:

A result object indicating success or failure. On failure, it contains a GraphError.

Return type:

Result

valid_layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

Node

window(start, end)#

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

Parameters:
  • start (int | DateTime | str | None) – The start time of the window (unbounded if None).

  • end (int | DateTime | str | None) – The end time of the window (unbounded if None).

Returns: r A Node object.

window_size#

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