PathFromGraph#

class PathFromGraph#

Bases: object

Methods:

after(start)

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

at(time)

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

before(end)

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

collect()

Collect all nodes into a list

default_layer()

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

degree()

the node degrees

exclude_layer(name)

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

exclude_layers(names)

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

exclude_valid_layer(name)

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

filter_edges(filter)

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

filter_exploded_edges(filter)

Return a filtered view that only includes exploded edges that satisfy the filter

filter_nodes(filter)

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

has_layer(name)

Check if PathFromGraph 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()

the node in-degrees

latest()

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

layer(name)

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

layers(names)

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

out_degree()

the node out-degrees

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 PathFromGraph including all events that have not been explicitly deleted at time.

snapshot_latest()

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

type_filter(node_types)

filter nodes by type

valid_layers(names)

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

window(start, end)

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

Attributes:

earliest_date_time

Returns the earliest date time of the nodes.

earliest_time

the node earliest times

edges

Get the edges that are incident to this node.

end

Gets the latest time that this PathFromGraph is valid.

end_date_time

Gets the latest datetime that this PathFromGraph is valid

id

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

the node latest times

name

the node names

neighbours

Get the neighbours of this node.

node_type

the node types

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 node properties

start

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

start_date_time

Gets the earliest datetime that this PathFromGraph is valid

window_size

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

after(start)#

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

Parameters:

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

Return type:

PathFromGraph

at(time)#

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

Parameters:

time (TimeInput) – The time of the window.

Return type:

PathFromGraph

before(end)#

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

Parameters:

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

Return type:

PathFromGraph

collect()#

Collect all nodes into a list

Returns:

the list of nodes

Return type:

list[list[Node]]

default_layer()#

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

degree()#

the node degrees

earliest_date_time#

Returns the earliest date time of the nodes.

earliest_time#

the node earliest times

edges#

Get the edges that are incident to this node.

Returns:

The incident edges.

Return type:

NestedEdges

end#

Gets the latest time that this PathFromGraph is valid.

Returns:

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

Return type:

Optional[int]

end_date_time#

Gets the latest datetime that this PathFromGraph is valid

Returns:

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

Return type:

Optional[datetime]

exclude_layer(name)#

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

PathFromGraph

exclude_layers(names)#

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

PathFromGraph

exclude_valid_layer(name)#

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

PathFromGraph

exclude_valid_layers(names)#

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

PathFromGraph

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

filter_edges(filter)#

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

Parameters:

filter (PropertyFilter) – The filter to apply to the edge properties. Construct a filter using Prop.

Returns:

The filtered view

Return type:

PathFromGraph

filter_exploded_edges(filter)#

Return a filtered view that only includes exploded edges that satisfy the filter

Parameters:

filter (PropertyFilter) – The filter to apply to the exploded edge properties. Construct a filter using Prop.

Returns:

The filtered view

Return type:

PathFromGraph

filter_nodes(filter)#

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

Parameters:

filter (PropertyFilter) – The filter to apply to the node properties. Construct a filter using Prop.

Returns:

The filtered view

Return type:

PathFromGraph

has_layer(name)#

Check if PathFromGraph has the layer “name”

Parameters:

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

Return type:

bool

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.

id#

the node ids

in_degree()#

the node in-degrees

in_edges#

Get the edges that point into this node.

Returns:

The inbound edges.

Return type:

NestedEdges

in_neighbours#

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

Returns:

The in-neighbours.

Return type:

PathFromGraph

latest()#

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

Return type:

PathFromGraph

latest_date_time#

Returns the latest date time of the nodes.

latest_time#

the node latest times

layer(name)#

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

PathFromGraph

layers(names)#

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

PathFromGraph

name#

the node names

neighbours#

Get the neighbours of this node.

Returns:

The neighbours (both inbound and outbound).

Return type:

PathFromGraph

node_type#

the node types

out_degree()#

the node out-degrees

out_edges#

Get the edges that point out of this node.

Returns:

The outbound edges.

Return type:

NestedEdges

out_neighbours#

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

Returns:

The out-neighbours.

Return type:

PathFromGraph

properties#

the node 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. 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:

PathFromGraph

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:

PathFromGraph

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:

PathFromGraph

snapshot_at(time)#

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

PathFromGraph

snapshot_latest()#

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

PathFromGraph

start#

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

Returns:

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

Return type:

Optional[int]

start_date_time#

Gets the earliest datetime that this PathFromGraph is valid

Returns:

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

Return type:

Optional[datetime]

type_filter(node_types)#

filter nodes by type

Parameters:

node_types (list[str]) – the node types to keep

Returns:

the filtered view

Return type:

PathFromGraph

valid_layers(names)#

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

PathFromGraph

window(start, end)#

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

PathFromGraph

window_size#

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

Return type:

Optional[int]