Edge#
- class raphtory.Edge#
Bases:
object
PyEdge is a Python class that represents an edge in the graph. An edge is a directed connection between two nodes.
Methods:
after
(start)Create a view of the Edge including all events after start (exclusive).
at
(time)Create a view of the Edge including all events at time.
before
(end)Create a view of the Edge including all events before end (exclusive).
Return a view of Edge containing only the default edge layer :returns: The layered view :rtype: Edge
Returns a list of timestamps of when an edge is deleted
Returns a list of timestamps of when an edge is deleted
exclude_layer
(name)Return a view of Edge containing all layers except the excluded name Errors if any of the layers do not exist.
exclude_layers
(names)Return a view of Edge containing all layers except the excluded names Errors if any of the layers do not exist.
exclude_valid_layer
(name)Return a view of Edge 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 Edge 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 an edge and returns all instances it had been updated as seperate edges
has_layer
(name)Check if Edge has the layer "name"
history
()Returns a list of timestamps of when an edge is added or change to an edge is made.
Returns a list of timestamps of when an edge is added or change to an edge is made.
Check if the edge is currently active (i.e., has at least one update within this period) :returns: bool
Check if the edge is currently deleted :returns: bool
Check if the edge is on the same node :returns: bool
is_valid
()Check if the edge is currently valid (i.e., not deleted) :returns: bool
latest
()Create a view of the Edge including all events at the latest time.
layer
(name)Return a view of Edge containing the layer "name" Errors if the layer does not exist
layers
(names)Return a view of Edge 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 Edge including all events that have not been explicitly deleted at time.
Create a view of the Edge including all events that have not been explicitly deleted at the latest time.
valid_layers
(names)Return a view of Edge containing all layers names Any layers that do not exist are ignored
window
(start, end)Create a view of the Edge including all events between start (inclusive) and end (exclusive)
Attributes:
Gets the datetime of an exploded edge.
Returns the destination node of the edge.
Gets of earliest datetime of an edge.
Gets the earliest time of an edge.
Gets the latest time that this Edge is valid.
Gets the latest datetime that this Edge is valid
The id of the edge.
Gets of latest datetime of an edge.
Gets the latest time of an edge.
Gets the name of the layer this edge belongs to - assuming it only belongs to one layer
Gets the names of the layers this edge belongs to
Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)
Returns a view of the properties of the edge.
Returns the source node of the edge.
Gets the start time for rolling and expanding windows for this Edge
Gets the earliest datetime that this Edge is valid
Gets the time of an exploded edge.
Get the window size (difference between start and end) for this Edge
- after(start)#
Create a view of the Edge including all events after start (exclusive).
- Parameters:
start (TimeInput) – The start time of the window.
- Returns:
A Edge object.
- at(time)#
Create a view of the Edge including all events at time.
- Parameters:
time (TimeInput) – The time of the window.
- Returns:
A Edge object.
- before(end)#
Create a view of the Edge including all events before end (exclusive).
- Parameters:
end (TimeInput) – The end time of the window.
- Returns:
A Edge object.
- date_time#
Gets the datetime of an exploded edge.
- Returns:
the datetime of an exploded edge
- Return type:
Datetime
- default_layer()#
Return a view of Edge containing only the default edge layer :returns: The layered view :rtype: Edge
- deletions()#
Returns a list of timestamps of when an edge is deleted
- Returns:
A list of unix timestamps
- Return type:
List[int]
- deletions_data_time()#
Returns a list of timestamps of when an edge is deleted
- Returns:
List[Datetime]
- dst#
Returns the destination node of the edge.
- earliest_date_time#
Gets of earliest datetime of an edge.
- Returns:
the earliest datetime of an edge
- Return type:
Datetime
- earliest_time#
Gets the earliest time of an edge.
- Returns:
The earliest time of an edge
- Return type:
int
- end#
Gets the latest time that this Edge is valid.
- Returns:
The latest time that this Edge is valid or None if the Edge is valid for all times.
- end_date_time#
Gets the latest datetime that this Edge is valid
- Returns:
The latest datetime that this Edge is valid or None if the Edge is valid for all times.
- exclude_layer(name)#
Return a view of Edge 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:
- exclude_layers(names)#
Return a view of Edge 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:
- exclude_valid_layer(name)#
Return a view of Edge 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 Edge 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.
- Parameters:
step (int | str) – The step size of the window.
- Returns:
A WindowSet object.
- Return type:
WindowSet
- explode()#
Explodes an edge and returns all instances it had been updated as seperate edges
- explode_layers()#
- has_layer(name)#
Check if Edge has the layer “name”
- history()#
Returns a list of timestamps of when an edge is added or change to an edge is made.
- Returns:
A list of unix timestamps.
- Return type:
List[int]
- history_date_time()#
Returns a list of timestamps of when an edge is added or change to an edge is made.
- Returns:
List[Datetime]
- id#
The id of the edge.
- is_active()#
Check if the edge is currently active (i.e., has at least one update within this period) :returns: bool
- is_deleted()#
Check if the edge is currently deleted :returns: bool
- is_self_loop()#
Check if the edge is on the same node :returns: bool
- is_valid()#
Check if the edge is currently valid (i.e., not deleted) :returns: bool
- latest()#
Create a view of the Edge including all events at the latest time.
- Returns:
A Edge object.
- latest_date_time#
Gets of latest datetime of an edge.
- Returns:
the latest datetime of an edge
- Return type:
Datetime
- latest_time#
Gets the latest time of an edge.
- Returns:
The latest time of an edge
- Return type:
int
- layer(name)#
Return a view of Edge containing the layer “name” Errors if the layer does not exist
- Returns:
The layered view
- Return type:
- layer_name#
Gets the name of the layer this edge belongs to - assuming it only belongs to one layer
- Returns:
The name of the layer
- Return type:
str
- layer_names#
Gets the names of the layers this edge belongs to
- Returns:
List[str]- The name of the layer
- layers(names)#
Return a view of Edge 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:
- nbr#
Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)
- properties#
Returns a view of the properties of the edge.
- Returns:
Properties on the Edge.
- 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
- Returns:
A Edge object.
- 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
- Returns:
A Edge object.
- 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
- snapshot_at(time)#
Create a view of the Edge including all events that have not been explicitly deleted at time.
This is equivalent to before(time + 1) for EventGraph`s and `at(time) for `PersitentGraph`s
- Parameters:
time (TimeInput) – The time of the window.
- Returns:
A Edge object.
- snapshot_latest()#
Create a view of the Edge including all events that have not been explicitly deleted at the latest time.
This is equivalent to a no-op for EventGraph`s and `latest() for `PersitentGraph`s
- Returns:
A Edge object.
- src#
Returns the source node of the edge.
- start#
Gets the start time for rolling and expanding windows for this Edge
- Returns:
The earliest time that this Edge is valid or None if the Edge is valid for all times.
- start_date_time#
Gets the earliest datetime that this Edge is valid
- Returns:
The earliest datetime that this Edge is valid or None if the Edge is valid for all times.
- time#
Gets the time of an exploded edge.
- Returns:
The time of an exploded edge
- Return type:
int
- valid_layers(names)#
Return a view of Edge 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:
- window(start, end)#
Create a view of the Edge 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).
Returns: r A Edge object.
- window_size#
Get the window size (difference between start and end) for this Edge
- class raphtory.Edges#
Bases:
object
A list of edges that can be iterated over.
Methods:
after
(start)Create a view of the Edges including all events after start (exclusive).
at
(time)Create a view of the Edges including all events at time.
before
(end)Create a view of the Edges including all events before end (exclusive).
collect
()Collect all edges into a list
count
()Returns the number of edges
Return a view of Edges containing only the default edge layer :returns: The layered view :rtype: Edges
Returns all timestamps of edges where an edge is deleted
Returns all timestamps of edges where an edge is deleted
exclude_layer
(name)Return a view of Edges containing all layers except the excluded name Errors if any of the layers do not exist.
exclude_layers
(names)Return a view of Edges containing all layers except the excluded names Errors if any of the layers do not exist.
exclude_valid_layer
(name)Return a view of Edges 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 Edges 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 an edge and returns all instances it had been updated as seperate edges
has_layer
(name)Check if Edges has the layer "name"
history
()Returns all timestamps of edges, when an edge is added or change to an edge is made.
Returns all timestamps of edges, when an edge is added or change to an edge is made.
Check if the edges are deleted
Check if the edges are on the same node
is_valid
()Check if the edges are valid (i.e. not deleted).
latest
()Create a view of the Edges including all events at the latest time.
layer
(name)Return a view of Edges containing the layer "name" Errors if the layer does not exist
layers
(names)Return a view of Edges 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 Edges including all events that have not been explicitly deleted at time.
Create a view of the Edges including all events that have not been explicitly deleted at the latest time.
to_df
([include_property_history, ...])Converts the graph's edges into a Pandas DataFrame.
valid_layers
(names)Return a view of Edges containing all layers names Any layers that do not exist are ignored
window
(start, end)Create a view of the Edges including all events between start (inclusive) and end (exclusive)
Attributes:
Returns the date times of exploded edges
Returns the destination node of the edge.
Returns the earliest date time of the edges.
Returns the earliest time of the edges.
Gets the latest time that this Edges is valid.
Gets the latest datetime that this Edges is valid
Returns all ids of the edges.
Returns the latest date time of the edges.
Returns the latest time of the edges.
Get the layer name that all edges belong to - assuming they only belong to one layer
Get the layer names that all edges belong to - assuming they only belong to one layer
Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)
Returns all properties of the edges
Returns the source node of the edge.
Gets the start time for rolling and expanding windows for this Edges
Gets the earliest datetime that this Edges is valid
Returns the times of exploded edges
Get the window size (difference between start and end) for this Edges
- after(start)#
Create a view of the Edges including all events after start (exclusive).
- Parameters:
start (TimeInput) – The start time of the window.
- Returns:
A Edges object.
- at(time)#
Create a view of the Edges including all events at time.
- Parameters:
time (TimeInput) – The time of the window.
- Returns:
A Edges object.
- before(end)#
Create a view of the Edges including all events before end (exclusive).
- Parameters:
end (TimeInput) – The end time of the window.
- Returns:
A Edges object.
- count()#
Returns the number of edges
- date_time#
Returns the date times of exploded edges
- Returns:
A list of date times.
- default_layer()#
Return a view of Edges containing only the default edge layer :returns: The layered view :rtype: Edges
- deletions()#
Returns all timestamps of edges where an edge is deleted
- Returns:
A list of lists of unix timestamps
- deletions_date_time()#
Returns all timestamps of edges where an edge is deleted
- Returns:
A list of lists of DateTime objects
- dst#
Returns the destination node of the edge.
- earliest_date_time#
Returns the earliest date time of the edges.
- Returns:
Earliest date time of the edges.
- earliest_time#
Returns the earliest time of the edges.
Returns: Earliest time of the edges.
- end#
Gets the latest time that this Edges is valid.
- Returns:
The latest time that this Edges is valid or None if the Edges is valid for all times.
- end_date_time#
Gets the latest datetime that this Edges is valid
- Returns:
The latest datetime that this Edges is valid or None if the Edges is valid for all times.
- exclude_layer(name)#
Return a view of Edges 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:
- exclude_layers(names)#
Return a view of Edges 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:
- exclude_valid_layer(name)#
Return a view of Edges 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 Edges 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.
- Parameters:
step (int | str) – The step size of the window.
- Returns:
A WindowSet object.
- Return type:
WindowSet
- explode()#
Explodes an edge and returns all instances it had been updated as seperate edges
- explode_layers()#
- has_layer(name)#
Check if Edges has the layer “name”
- history()#
Returns all timestamps of edges, when an edge is added or change to an edge is made.
- Returns:
A list of lists unix timestamps.
- history_date_time()#
Returns all timestamps of edges, when an edge is added or change to an edge is made.
- Returns:
A list of lists of timestamps.
- id#
Returns all ids of the edges.
- is_active()#
- is_deleted()#
Check if the edges are deleted
- is_self_loop()#
Check if the edges are on the same node
- is_valid()#
Check if the edges are valid (i.e. not deleted)
- latest()#
Create a view of the Edges including all events at the latest time.
- Returns:
A Edges object.
- latest_date_time#
Returns the latest date time of the edges.
- Returns:
Latest date time of the edges.
- latest_time#
Returns the latest time of the edges.
- Returns:
Latest time of the edges.
- layer(name)#
Return a view of Edges containing the layer “name” Errors if the layer does not exist
- Returns:
The layered view
- Return type:
- layer_name#
Get the layer name that all edges belong to - assuming they only belong to one layer
- Returns:
The name of the layer
- layer_names#
Get the layer names that all edges belong to - assuming they only belong to one layer
- Returns:
A list of layer names
- layers(names)#
Return a view of Edges 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:
- 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
- Returns:
A Edges object.
- 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
- Returns:
A Edges object.
- 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
- snapshot_at(time)#
Create a view of the Edges including all events that have not been explicitly deleted at time.
This is equivalent to before(time + 1) for EventGraph`s and `at(time) for `PersitentGraph`s
- Parameters:
time (TimeInput) – The time of the window.
- Returns:
A Edges object.
- snapshot_latest()#
Create a view of the Edges including all events that have not been explicitly deleted at the latest time.
This is equivalent to a no-op for EventGraph`s and `latest() for `PersitentGraph`s
- Returns:
A Edges object.
- src#
Returns the source node of the edge.
- start#
Gets the start time for rolling and expanding windows for this Edges
- Returns:
The earliest time that this Edges is valid or None if the Edges is valid for all times.
- start_date_time#
Gets the earliest datetime that this Edges is valid
- Returns:
The earliest datetime that this Edges is valid or None if the Edges is valid for all times.
- time#
Returns the times of exploded edges
- Returns:
Time of edge
- to_df(include_property_history=True, convert_datetime=False, explode=False)#
Converts the graph’s edges into a Pandas DataFrame.
This method will create a DataFrame with the following columns: - “src”: The source node of the edge. - “dst”: The destination node of the edge. - “layer”: The layer of the edge. - “properties”: The properties of the edge. - “update_history”: The update history of the edge. This column will be included if include_update_history is set to true.
- Parameters:
include_property_history (bool) – A boolean, if set to True, the history of each property is included, if False, only the latest value is shown. Ignored if exploded. Defaults to True.
convert_datetime (bool) – A boolean, if set to True will convert the timestamp to python datetimes. Defaults to False.
explode (bool) – A boolean, if set to True, will explode each edge update into its own row. Defaults to False.
- Returns:
If successful, this PyObject will be a Pandas DataFrame.
- Return type:
DataFrame
- valid_layers(names)#
Return a view of Edges 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:
- window(start, end)#
Create a view of the Edges 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).
Returns: r A Edges object.
- window_size#
Get the window size (difference between start and end) for this Edges
- class raphtory.MutableEdge#
Bases:
Edge
Methods:
add_constant_properties
(properties[, layer])Add constant properties to an edge in the graph.
add_updates
(t[, properties, layer])Add updates to an edge in the graph at a specified time.
after
(start)Create a view of the Edge including all events after start (exclusive).
at
(time)Create a view of the Edge including all events at time.
before
(end)Create a view of the Edge including all events before end (exclusive).
Return a view of Edge containing only the default edge layer :returns: The layered view :rtype: Edge
delete
(t[, layer])Mark the edge as deleted at the specified time.
Returns a list of timestamps of when an edge is deleted
Returns a list of timestamps of when an edge is deleted
exclude_layer
(name)Return a view of Edge containing all layers except the excluded name Errors if any of the layers do not exist.
exclude_layers
(names)Return a view of Edge containing all layers except the excluded names Errors if any of the layers do not exist.
exclude_valid_layer
(name)Return a view of Edge 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 Edge 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 an edge and returns all instances it had been updated as seperate edges
has_layer
(name)Check if Edge has the layer "name"
history
()Returns a list of timestamps of when an edge is added or change to an edge is made.
Returns a list of timestamps of when an edge is added or change to an edge is made.
Check if the edge is currently active (i.e., has at least one update within this period) :returns: bool
Check if the edge is currently deleted :returns: bool
Check if the edge is on the same node :returns: bool
is_valid
()Check if the edge is currently valid (i.e., not deleted) :returns: bool
latest
()Create a view of the Edge including all events at the latest time.
layer
(name)Return a view of Edge containing the layer "name" Errors if the layer does not exist
layers
(names)Return a view of Edge 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 Edge including all events that have not been explicitly deleted at time.
Create a view of the Edge including all events that have not been explicitly deleted at the latest time.
update_constant_properties
(properties[, layer])Update constant properties of an edge in the graph overwriting existing values.
valid_layers
(names)Return a view of Edge containing all layers names Any layers that do not exist are ignored
window
(start, end)Create a view of the Edge including all events between start (inclusive) and end (exclusive)
Attributes:
Gets the datetime of an exploded edge.
Returns the destination node of the edge.
Gets of earliest datetime of an edge.
Gets the earliest time of an edge.
Gets the latest time that this Edge is valid.
Gets the latest datetime that this Edge is valid
The id of the edge.
Gets of latest datetime of an edge.
Gets the latest time of an edge.
Gets the name of the layer this edge belongs to - assuming it only belongs to one layer
Gets the names of the layers this edge belongs to
Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)
Returns a view of the properties of the edge.
Returns the source node of the edge.
Gets the start time for rolling and expanding windows for this Edge
Gets the earliest datetime that this Edge is valid
Gets the time of an exploded edge.
Get the window size (difference between start and end) for this Edge
- add_constant_properties(properties, layer=None)#
Add constant properties to an edge in the graph. This function is used to add properties to an edge that remain constant and do not change over time. These properties are fundamental attributes of the edge.
- Parameters:
properties (PropInput) – A dictionary of properties to be added to the edge.
layer (str, optional) – The layer you want these properties to be added on to.
- add_updates(t, properties=None, layer=None)#
Add updates to an edge in the graph at a specified time. This function allows for the addition of property updates to an edge within the graph. The updates are time-stamped, meaning they are applied at the specified time.
- Parameters:
t (TimeInput) – The timestamp at which the updates should be applied.
properties (PropInput, optional) – A dictionary of properties to update.
layer (str, optional) – The layer you want these properties to be added on to.
- after(start)#
Create a view of the Edge including all events after start (exclusive).
- Parameters:
start (TimeInput) – The start time of the window.
- Returns:
A Edge object.
- at(time)#
Create a view of the Edge including all events at time.
- Parameters:
time (TimeInput) – The time of the window.
- Returns:
A Edge object.
- before(end)#
Create a view of the Edge including all events before end (exclusive).
- Parameters:
end (TimeInput) – The end time of the window.
- Returns:
A Edge object.
- date_time#
Gets the datetime of an exploded edge.
- Returns:
the datetime of an exploded edge
- Return type:
Datetime
- default_layer()#
Return a view of Edge containing only the default edge layer :returns: The layered view :rtype: Edge
- delete(t, layer=None)#
Mark the edge as deleted at the specified time.
- Parameters:
t (TimeInput) – The timestamp at which the deletion should be applied.
layer (str, optional) – The layer you want the deletion applied to .
- deletions()#
Returns a list of timestamps of when an edge is deleted
- Returns:
A list of unix timestamps
- Return type:
List[int]
- deletions_data_time()#
Returns a list of timestamps of when an edge is deleted
- Returns:
List[Datetime]
- dst#
Returns the destination node of the edge.
- earliest_date_time#
Gets of earliest datetime of an edge.
- Returns:
the earliest datetime of an edge
- Return type:
Datetime
- earliest_time#
Gets the earliest time of an edge.
- Returns:
The earliest time of an edge
- Return type:
int
- end#
Gets the latest time that this Edge is valid.
- Returns:
The latest time that this Edge is valid or None if the Edge is valid for all times.
- end_date_time#
Gets the latest datetime that this Edge is valid
- Returns:
The latest datetime that this Edge is valid or None if the Edge is valid for all times.
- exclude_layer(name)#
Return a view of Edge 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:
- exclude_layers(names)#
Return a view of Edge 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:
- exclude_valid_layer(name)#
Return a view of Edge 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 Edge 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.
- Parameters:
step (int | str) – The step size of the window.
- Returns:
A WindowSet object.
- Return type:
WindowSet
- explode()#
Explodes an edge and returns all instances it had been updated as seperate edges
- explode_layers()#
- has_layer(name)#
Check if Edge has the layer “name”
- history()#
Returns a list of timestamps of when an edge is added or change to an edge is made.
- Returns:
A list of unix timestamps.
- Return type:
List[int]
- history_date_time()#
Returns a list of timestamps of when an edge is added or change to an edge is made.
- Returns:
List[Datetime]
- id#
The id of the edge.
- is_active()#
Check if the edge is currently active (i.e., has at least one update within this period) :returns: bool
- is_deleted()#
Check if the edge is currently deleted :returns: bool
- is_self_loop()#
Check if the edge is on the same node :returns: bool
- is_valid()#
Check if the edge is currently valid (i.e., not deleted) :returns: bool
- latest()#
Create a view of the Edge including all events at the latest time.
- Returns:
A Edge object.
- latest_date_time#
Gets of latest datetime of an edge.
- Returns:
the latest datetime of an edge
- Return type:
Datetime
- latest_time#
Gets the latest time of an edge.
- Returns:
The latest time of an edge
- Return type:
int
- layer(name)#
Return a view of Edge containing the layer “name” Errors if the layer does not exist
- Returns:
The layered view
- Return type:
- layer_name#
Gets the name of the layer this edge belongs to - assuming it only belongs to one layer
- Returns:
The name of the layer
- Return type:
str
- layer_names#
Gets the names of the layers this edge belongs to
- Returns:
List[str]- The name of the layer
- layers(names)#
Return a view of Edge 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:
- nbr#
Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)
- properties#
Returns a view of the properties of the edge.
- Returns:
Properties on the Edge.
- 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
- Returns:
A Edge object.
- 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
- Returns:
A Edge object.
- 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
- snapshot_at(time)#
Create a view of the Edge including all events that have not been explicitly deleted at time.
This is equivalent to before(time + 1) for EventGraph`s and `at(time) for `PersitentGraph`s
- Parameters:
time (TimeInput) – The time of the window.
- Returns:
A Edge object.
- snapshot_latest()#
Create a view of the Edge including all events that have not been explicitly deleted at the latest time.
This is equivalent to a no-op for EventGraph`s and `latest() for `PersitentGraph`s
- Returns:
A Edge object.
- src#
Returns the source node of the edge.
- start#
Gets the start time for rolling and expanding windows for this Edge
- Returns:
The earliest time that this Edge is valid or None if the Edge is valid for all times.
- start_date_time#
Gets the earliest datetime that this Edge is valid
- Returns:
The earliest datetime that this Edge is valid or None if the Edge is valid for all times.
- time#
Gets the time of an exploded edge.
- Returns:
The time of an exploded edge
- Return type:
int
- update_constant_properties(properties, layer=None)#
Update constant properties of an edge in the graph overwriting existing values. This function is used to add properties to an edge that remains constant and does not change over time. These properties are fundamental attributes of the edge.
- Parameters:
properties (PropInput) – A dictionary of properties to be added to the edge.
layer (str, optional) – The layer you want these properties to be added on to.
- valid_layers(names)#
Return a view of Edge 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:
- window(start, end)#
Create a view of the Edge 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).
Returns: r A Edge object.
- window_size#
Get the window size (difference between start and end) for this Edge