NestedEdges#

class NestedEdges#

Bases: object

Methods:

after(start)

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

at(time)

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

before(end)

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

collect()

Collect all edges into a list

default_layer()

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

deletions()

Returns all timestamps of edges, where an edge is deleted

deletions_date_time()

Returns all timestamps of edges, where an edge is deleted

exclude_layer(name)

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

exclude_layers(names)

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

exclude_valid_layer(name)

Return a view of NestedEdges 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 NestedEdges 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.

explode()

Explodes returns an edge object for each update within the original edge.

explode_layers()

Explode layers returns an edge object for each layer within the original edge.

has_layer(name)

Check if NestedEdges has the layer "name"

history()

Returns all timestamps of edges, when an edge is added or change to an edge is made.

history_date_time()

Returns all timestamps of edges, when an edge is added or change to an edge is made.

is_active()

is_deleted()

Check if edges are deleted

is_self_loop()

Check if the edges are on the same node

is_valid()

Check if edges are valid (i.e., not deleted)

latest()

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

layer(name)

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

layers(names)

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

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)

snapshot_at(time)

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

snapshot_latest()

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

valid_layers(names)

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

window(start, end)

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

Attributes:

date_time

Get the date times of exploded edges

dst

Returns the destination node of the edge.

earliest_date_time

Returns the earliest date time of the edges.

earliest_time

Returns the earliest time of the edges.

end

Gets the latest time that this NestedEdges is valid.

end_date_time

Gets the latest datetime that this NestedEdges is valid

id

Returns all ids of the edges.

latest_date_time

Returns the latest date time of the edges.

latest_time

Returns the latest time of the edges.

layer_name

Returns the name of the layer the edges belong to - assuming they only belong to one layer

layer_names

Returns the names of the layers the edges belong to

nbr

Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)

properties

Returns all properties of the edges

src

Returns the source node of the edge.

start

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

start_date_time

Gets the earliest datetime that this NestedEdges is valid

time

Returns the times of exploded edges

window_size

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

after(start)#

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

Parameters:

start (TimeInput) – The start time of the window.

Return type:

NestedEdges

at(time)#

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

Parameters:

time (TimeInput) – The time of the window.

Return type:

NestedEdges

before(end)#

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

Parameters:

end (TimeInput) – The end time of the window.

Return type:

NestedEdges

collect()#

Collect all edges into a list

Returns:

the list of edges

Return type:

list[list[Edges]]

date_time#

Get the date times of exploded edges

default_layer()#

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

deletions()#

Returns all timestamps of edges, where an edge is deleted

Returns:

A list of lists of lists of unix timestamps

deletions_date_time()#

Returns all timestamps of edges, where an edge is deleted

Returns:

A list of lists of lists of DateTime objects

dst#

Returns the destination node of the edge.

earliest_date_time#

Returns the earliest date time of the edges.

earliest_time#

Returns the earliest time of the edges.

end#

Gets the latest time that this NestedEdges is valid.

Returns:

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

Return type:

Optional[int]

end_date_time#

Gets the latest datetime that this NestedEdges is valid

Returns:

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

Return type:

Optional[datetime]

exclude_layer(name)#

Return a view of NestedEdges 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:

NestedEdges

exclude_layers(names)#

Return a view of NestedEdges 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:

NestedEdges

exclude_valid_layer(name)#

Return a view of NestedEdges 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:

NestedEdges

exclude_valid_layers(names)#

Return a view of NestedEdges 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:

NestedEdges

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.

Return type:

WindowSet

explode()#

Explodes returns an edge object for each update within the original edge.

explode_layers()#

Explode layers returns an edge object for each layer within the original edge. These new edge object contains only updates from respective layers.

has_layer(name)#

Check if NestedEdges has the layer “name”

Parameters:

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

Return type:

bool

history()#

Returns all timestamps of edges, when an edge is added or change to an edge is made.

history_date_time()#

Returns all timestamps of edges, when an edge is added or change to an edge is made.

id#

Returns all ids of the edges.

is_active()#
is_deleted()#

Check if edges are deleted

is_self_loop()#

Check if the edges are on the same node

is_valid()#

Check if edges are valid (i.e., not deleted)

latest()#

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

Return type:

NestedEdges

latest_date_time#

Returns the latest date time of the edges.

latest_time#

Returns the latest time of the edges.

layer(name)#

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

Parameters:

name (str) – then name of the layer.

Returns:

The layered view

Return type:

NestedEdges

layer_name#

Returns the name of the layer the edges belong to - assuming they only belong to one layer

layer_names#

Returns the names of the layers the edges belong to

layers(names)#

Return a view of NestedEdges 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:

NestedEdges

nbr#

Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)

properties#

Returns all properties of the edges

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. step defaults to window.

Returns:

A WindowSet object.

Return type:

WindowSet

shrink_end(end)#

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

Parameters:

end (TimeInput) – the new end time of the window

Return type:

NestedEdges

shrink_start(start)#

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

Parameters:

start (TimeInput) – the new start time of the window

Return type:

NestedEdges

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:
  • start (TimeInput) – the new start time for the window

  • end (TimeInput) – the new end time for the window

Return type:

NestedEdges

snapshot_at(time)#

Create a view of the NestedEdges 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:

time (TimeInput) – The time of the window.

Return type:

NestedEdges

snapshot_latest()#

Create a view of the NestedEdges 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

Return type:

NestedEdges

src#

Returns the source node of the edge.

start#

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

Returns:

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

Return type:

Optional[int]

start_date_time#

Gets the earliest datetime that this NestedEdges is valid

Returns:

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

Return type:

Optional[datetime]

time#

Returns the times of exploded edges

valid_layers(names)#

Return a view of NestedEdges 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:

NestedEdges

window(start, end)#

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

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

  • end (TimeInput | None) – The end time of the window (unbounded if None).

Return type:

NestedEdges

window_size#

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

Return type:

Optional[int]