Nodes

A list of nodes that can be iterated over.

Methods

MethodDescription
afterCreate a view of the Nodes including all events after start (exclusive).
atCreate a view of the Nodes including all events at time.
beforeCreate a view of the Nodes including all events before end (exclusive).
collectCollect all nodes into a list
default_layerReturn a view of Nodes containing only the default edge layer
degreeReturns the number of edges of the nodes.
edge_history_countReturn the number of edge updates for each node
exclude_layerReturn a view of Nodes containing all layers except the excluded name
exclude_layersReturn a view of Nodes containing all layers except the excluded names
exclude_valid_layerReturn a view of Nodes containing all layers except the excluded name
exclude_valid_layersReturn a view of Nodes 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 Nodes has the layer "name"
in_degreeReturns the number of in edges of the nodes.
latestCreate a view of the Nodes including all events at the latest time.
layerReturn a view of Nodes containing the layer "name"
layersReturn a view of Nodes containing all layers names
out_degreeReturns the number of out edges of the nodes.
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 Nodes including all events that have not been explicitly deleted at time.
snapshot_latestCreate a view of the Nodes including all events that have not been explicitly deleted at the latest time.
to_dfConverts the graph's nodes into a Pandas DataFrame.
type_filterFilter nodes by node type.
valid_layersReturn a view of Nodes containing all layers names
windowCreate a view of the Nodes including all events between start (inclusive) and end (exclusive)

Properties

PropertyDescription
earliest_timeThe earliest times nodes are active
edgesGet the edges that are incident to this node.
endGets the latest time that this Nodes is valid.
historyReturns all history objects of nodes, with information on when a node is added or change to a node is made.
idThe node ids
in_edgesGet the edges that point into this node.
in_neighboursGet the neighbours of this node that point into this node.
latest_timeThe latest time nodes are active
metadataThe metadata of the nodes.
nameThe node names
neighboursGet the neighbours of this node.
node_typeThe node types
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 Nodes
window_sizeGet the window size (difference between start and end) for this Nodes.

Method Details

after

Signature: after(start)

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

Parameters

NameTypeDefaultDescription
startTimeInput-The start time of the window.

Returns

TypeDescription
Nodes

at

Signature: at(time)

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

Parameters

NameTypeDefaultDescription
timeTimeInput-The time of the window.

Returns

TypeDescription
Nodes

before

Signature: before(end)

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

Parameters

NameTypeDefaultDescription
endTimeInput-The end time of the window.

Returns

TypeDescription
Nodes

collect

Collect all nodes into a list

Returns

TypeDescription
list[Node]the list of nodes

default_layer

Return a view of Nodes containing only the default edge layer

Returns

TypeDescription
NodesThe layered view

degree

Returns the number of edges of the nodes.

Returns

TypeDescription
DegreeViewa view of the undirected node degrees.

edge_history_count

Return the number of edge updates for each node

Returns

TypeDescription
EdgeHistoryCountViewa view of the edge history counts

exclude_layer

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

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

Returns

TypeDescription
NodesThe layered view

exclude_layers

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

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

Returns

TypeDescription
NodesThe layered view

exclude_valid_layer

Signature: exclude_valid_layer(name)

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

Parameters

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

Returns

TypeDescription
NodesThe layered view

exclude_valid_layers

Signature: exclude_valid_layers(names)

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

Parameters

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

Returns

TypeDescription
NodesThe 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
NodesThe filtered view

has_layer

Signature: has_layer(name)

Check if Nodes has the layer "name"

Parameters

NameTypeDefaultDescription
namestr-the name of the layer to check

Returns

TypeDescription
bool

in_degree

Returns the number of in edges of the nodes.

Returns

TypeDescription
DegreeViewa view of the in-degrees of the nodes

latest

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

Returns

TypeDescription
Nodes

layer

Signature: layer(name)

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

Parameters

NameTypeDefaultDescription
namestr-then name of the layer.

Returns

TypeDescription
NodesThe layered view

layers

Signature: layers(names)

Return a view of Nodes 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
NodesThe layered view

out_degree

Returns the number of out edges of the nodes.

Returns

TypeDescription
DegreeViewa view of the out-degrees of the nodes.

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
Nodes

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
Nodes

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
Nodes

snapshot_at

Signature: snapshot_at(time)

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

snapshot_latest

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

to_df

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

NameTypeDefaultDescription
include_property_historybool, optionalFalseA boolean, if set to True, the history of each property is included, if False, only the latest value is shown. Defaults to False.
convert_datetimebool, optionalFalseA boolean, if set to True will convert the timestamp to python datetimes. Defaults to False.

Returns

TypeDescription
DataFramethe view of the node data as a pandas Dataframe.

type_filter

Signature: type_filter(node_types)

Filter nodes by node type.

Parameters

NameTypeDefaultDescription
node_typeslist[str]-the list of node types to keep.

Returns

TypeDescription
Nodesthe filtered view of the nodes

valid_layers

Signature: valid_layers(names)

Return a view of Nodes 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
NodesThe layered view

window

Signature: window(start, end)

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

Property Details

earliest_time

The earliest times nodes are active

Returns

TypeDescription
EarliestTimeViewa view of the earliest active times

edges

Get the edges that are incident to this node.

Returns

TypeDescription
NestedEdgesThe incident edges.

end

Gets the latest time that this Nodes is valid.

Returns

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

history

Returns all history objects of nodes, with information on when a node is added or change to a node is made.

Returns

TypeDescription
HistoryViewa view of the node histories

id

The node ids

Returns

TypeDescription
IdViewa view of the node ids

in_edges

Get the edges that point into this node.

Returns

TypeDescription
NestedEdgesThe inbound edges.

in_neighbours

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

Returns

TypeDescription
PathFromGraphThe in-neighbours.

latest_time

The latest time nodes are active

Returns

TypeDescription
LatestTimeViewa view of the latest active times

metadata

The metadata of the nodes.

Returns

TypeDescription
MetadataViewA view of the node properties.

name

The node names

Returns

TypeDescription
NameViewa view of the node names

neighbours

Get the neighbours of this node.

Returns

TypeDescription
PathFromGraphThe neighbours (both inbound and outbound).

node_type

The node types

Returns

TypeDescription
NodeTypeViewa view of the node types

out_edges

Get the edges that point out of this node.

Returns

TypeDescription
NestedEdgesThe outbound edges.

out_neighbours

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

Returns

TypeDescription
PathFromGraphThe out-neighbours.

properties

The properties of the node.

Returns

TypeDescription
PropertiesViewA view of the node properties.

start

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

Returns

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

window_size

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

Returns

TypeDescription
int, optional