Nodes#
- class 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
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.
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 Nodes has the layer "name"
history
()Returns all timestamps of nodes, when a node is added or change to a node is made.
Returns all timestamps of nodes, when a node is added or change to a node is made.
Returns the number of in edges of the nodes
latest
()Create a view of the Nodes including all events at the latest time.
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.
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)
snapshot_at
(time)Create a view of the Nodes including all events that have not been explicitly deleted at time.
Create a view of the Nodes including all events that have not been explicitly deleted at the latest time.
to_df
([include_property_history, ...])Converts the graph's nodes into a Pandas DataFrame.
type_filter
(node_types)Filter nodes by node type
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:
The earliest time nodes are active as datetime objects
The earliest times nodes are active
Get the edges that are incident to this node.
Gets the latest time that this Nodes is valid.
Gets the latest datetime that this Nodes is valid
The node ids
Get the edges that point into this node.
Get the neighbours of this node that point into this node.
The latest time nodes are active as datetime objects
The latest time nodes are active
The node names
Get the neighbours of this node.
The node types
Get the edges that point out of this node.
Get the neighbours of this node that point out of this node.
The properties of the node
Gets the start time for rolling and expanding windows for this Nodes
Gets the earliest datetime that this Nodes is valid
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).
- 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).
- 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:
a view of the undirected node degrees
- Return type:
- earliest_date_time#
The earliest time nodes are active as datetime objects
- Returns:
a view of the earliest active times.
- Return type:
- earliest_time#
The earliest times nodes are active
- Returns:
a view of the earliest active times
- Return type:
- edges#
Get the edges that are incident to this node.
- Returns:
The incident edges.
- Return type:
- end#
Gets the latest time that this Nodes is valid.
- end_date_time#
Gets the latest datetime that this Nodes is valid
- 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
- Returns:
The layered view
- Return type:
- 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:
- 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.
- 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:
- 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:
- 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:
- has_layer(name)#
Check if Nodes has the layer “name”
- history()#
Returns all timestamps of nodes, when a node is added or change to a node is made.
- Returns:
a view of the node histories
- Return type:
- history_date_time()#
Returns all timestamps of nodes, when a node is added or change to a node is made.
- Returns:
a view of the node histories as datetime objects.
- Return type:
- in_degree()#
Returns the number of in edges of the nodes
- Returns:
a view of the in-degrees of the nodes
- Return type:
- in_edges#
Get the edges that point into this node.
- Returns:
The inbound edges.
- Return type:
- in_neighbours#
Get the neighbours of this node that point into this node.
- Returns:
The in-neighbours.
- Return type:
- latest_date_time#
The latest time nodes are active as datetime objects
- Returns:
a view of the latest active times
- Return type:
- latest_time#
The latest time nodes are active
- Returns:
a view of the latest active times
- Return type:
- 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.
- neighbours#
Get the neighbours of this node.
- Returns:
The neighbours (both inbound and outbound).
- Return type:
- node_type#
The node types
- Returns:
a view of the node types
- Return type:
- out_degree()#
Returns the number of out edges of the nodes
- Returns:
a view of the out-degrees of the nodes
- Return type:
- out_edges#
Get the edges that point out of this node.
- Returns:
The outbound edges.
- Return type:
- out_neighbours#
Get the neighbours of this node that point out of this node.
- Returns:
The out-neighbours.
- Return type:
- properties#
The properties of the node
- Returns:
A view of the node properties
- Return type:
- 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.
- 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 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
- 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
- Return type:
- 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
- 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:
- Returns:
the view of the node data as a pandas Dataframe
- Return type:
- type_filter(node_types)#
Filter nodes by node type
- 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)