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()

Create a view including all the edges in the default layer

degree()

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

expanding(step)

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

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)

Create a view including all the edges in the layers name

layers(names)

Create a view including all the edges in the 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).

rolling(window[, step])

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

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 pointing to or from 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 are pointing to this node.

in_neighbours

Get the neighbours of this node that are pointing to it.

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.

out_edges

Get the edges that are pointing from this node.

out_neighbours

Get the neighbours of this node that are pointing from it.

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 – 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 – 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 – The end time of the window.

Returns:

A node object.

default_layer()#

Create a view including all the edges in the default layer

Returns:

a view including all the edges in the default layer

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 pointing to or from this node.

Returns:

A list of Edge objects.

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.

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) – The step size of the window.

Returns:

A WindowSet object.

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 are pointing to this node.

Returns:

A list of Edge objects.

in_neighbours#

Get the neighbours of this node that are pointing to it.

Returns:

A list of Node objects.

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)#

Create a view including all the edges in the layers name

Parameters:

name (str) – the name of the layer to include

Returns:

a view including all the edges in the layer name

layers(names)#

Create a view including all the edges in the layers names

Parameters:

name (str) – the name of the layers to include

Returns:

a view including all the edges in the layers names

name#

Returns the name of the node.

Returns:

The name of the node as a string.

neighbours#

Get the neighbours of this node.

Returns:

A list of Node objects.

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 are pointing from this node.

Returns:

A list of Edge objects.

out_neighbours#

Get the neighbours of this node that are pointing from it.

Returns:

A list of Node objects.

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 – The size of the window.

  • step – The step size of the window. Defaults to the window size.

Returns:

A WindowSet object.

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.

window(start=None, end=None)#

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

Parameters:
  • start – The start time of the window. Defaults to the start time of the node.

  • end – The end time of the window. Defaults to the end time of the node.

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()

Collects all nodes into a list

default_layer()

Create a view including all the edges in the default layer

degree()

Returns the number of edges of the nodes

expanding(step)

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

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)

Create a view including all the edges in the layers names

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.

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

Returns the edges of the nodes

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

Returns the in edges of the nodes

in_neighbours

Get the in neighbours of the nodes

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 the nodes

out_edges

Returns the out edges of the nodes

out_neighbours

Get the out neighbours of the nodes

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 – 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 – 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 – The end time of the window.

Returns:

A nodes object.

collect()#

Collects all nodes into a list

default_layer()#

Create a view including all the edges in the default layer

Returns:

a view including all the edges in the default layer

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#

Returns the edges of the nodes

Returns:

An iterator of edges of the nodes

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.

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) – The step size of the window.

Returns:

A WindowSet object.

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#

Returns the in edges of the nodes

Returns:

An iterator of in edges of the nodes

in_neighbours#

Get the in neighbours of the nodes

Returns:

An iterator of the in neighbours of the nodes

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)#

Create a view including all the edges in the layers names

Parameters:

name (str) – the name of the layers to include

Returns:

a view including all the edges in the layers names

name#

Returns an iterator over the nodes name

neighbours#

Get the neighbours of the nodes

Returns:

An iterator of the neighbours of the nodes

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#

Returns the out edges of the nodes

Returns:

An iterator of out edges of the nodes

out_neighbours#

Get the out neighbours of the nodes

Returns:

An iterator of the out neighbours of the nodes

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 – The size of the window.

  • step – The step size of the window. Defaults to the window size.

Returns:

A WindowSet object.

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.

window(start=None, end=None)#

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

Parameters:
  • start – The start time of the window. Defaults to the start time of the nodes.

  • end – The end time of the window. Defaults to the end time of the nodes.

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()

Create a view including all the edges in the default layer

degree()

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

expanding(step)

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

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)

Create a view including all the edges in the layers name

layers(names)

Create a view including all the edges in the 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).

rolling(window[, step])

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

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 pointing to or from 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 are pointing to this node.

in_neighbours

Get the neighbours of this node that are pointing to it.

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.

out_edges

Get the edges that are pointing from this node.

out_neighbours

Get the neighbours of this node that are pointing from it.

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 – 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 – 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 – The end time of the window.

Returns:

A node object.

default_layer()#

Create a view including all the edges in the default layer

Returns:

a view including all the edges in the default layer

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 pointing to or from this node.

Returns:

A list of Edge objects.

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.

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) – The step size of the window.

Returns:

A WindowSet object.

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 are pointing to this node.

Returns:

A list of Edge objects.

in_neighbours#

Get the neighbours of this node that are pointing to it.

Returns:

A list of Node objects.

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)#

Create a view including all the edges in the layers name

Parameters:

name (str) – the name of the layer to include

Returns:

a view including all the edges in the layer name

layers(names)#

Create a view including all the edges in the layers names

Parameters:

name (str) – the name of the layers to include

Returns:

a view including all the edges in the layers names

name#

Returns the name of the node.

Returns:

The name of the node as a string.

neighbours#

Get the neighbours of this node.

Returns:

A list of Node objects.

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 are pointing from this node.

Returns:

A list of Edge objects.

out_neighbours#

Get the neighbours of this node that are pointing from it.

Returns:

A list of Node objects.

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 – The size of the window.

  • step – The step size of the window. Defaults to the window size.

Returns:

A WindowSet object.

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.

window(start=None, end=None)#

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

Parameters:
  • start – The start time of the window. Defaults to the start time of the node.

  • end – The end time of the window. Defaults to the end time of the node.

Returns: r A node object.

window_size#

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