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).
expanding
(step)Creates a WindowSet with the given step size using an expanding window.
explode
()Explodes an Edge into a list of PyEdges.
Explodes an Edge into a list of PyEdges, one for each layer the edge is part of.
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.
layer
(name)layers
(layer_names)Get a new Edge with the properties of this Edge within the specified layers.
rolling
(window[, step])Creates a WindowSet with the given window size and optional step using a rolling window.
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.
Get 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 a view of the properties of the edge.
Get 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 – 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 – 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 – The end time of the window.
- Returns:
A edge object.
- date_time#
Gets the datetime of an exploded edge.
- Returns:
(datetime) the datetime of an exploded edge
- dst#
Get the destination node of the Edge.
- Returns:
The destination node of the Edge.
- earliest_date_time#
Gets of earliest datetime of an edge.
- Returns:
the earliest datetime of an edge
- earliest_time#
Gets the earliest time of an edge.
- Returns:
(int) The earliest time of an edge
- 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.
- 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) – The step size of the window.
- Returns:
A WindowSet object.
- explode()#
Explodes an Edge into a list of PyEdges. This is useful when you want to iterate over the properties of an Edge at every single point in time. This will return a seperate edge each time a property had been changed.
- Returns:
A list of PyEdges
- explode_layers()#
Explodes an Edge into a list of PyEdges, one for each layer the edge is part of. This is useful when you want to iterate over the properties of an Edge for every layer.
- Returns:
A list of PyEdges
- 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.
- history_date_time()#
Returns a list of timestamps of when an edge is added or change to an edge is made.
- Returns:
A list of timestamps.
- id#
The id of the edge.
- latest_date_time#
Gets of latest datetime of an edge.
- Returns:
(datetime) the latest datetime of an edge
- latest_time#
Gets the latest time of an edge.
- Returns:
(int) The latest time of an edge
- layer(name)#
- layer_name#
Gets the name of the layer this edge belongs to - assuming it only belongs to one layer
- Returns:
(List<str>) The name of the layer
- layer_names#
Gets the names of the layers this edge belongs to
- Returns:
(List<str>) The name of the layer
- layers(layer_names)#
Get a new Edge with the properties of this Edge within the specified layers.
- Parameters:
layer_names (List<str>) – Layers to be included in the new edge.
- Returns:
A new Edge with the properties of this Edge within the specified time window.
- 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 – The size of the window.
step – The step size of the window. Defaults to the window size.
- Returns:
A WindowSet object.
- src#
Get the source node of the Edge.
- 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:
(int) The time of an exploded edge
- window(start=None, end=None)#
Create a view of the edge including all events between start (inclusive) and end (exclusive)
- Parameters:
start – The start time of the window. Defaults to the start time of the edge.
end – The end time of the window. Defaults to the end time of the edge.
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)Filter edges to only include events after start.
at
(end)Get edges with the properties of these edges at a specific time.
before
(end)Filter edges to only include events before end.
collect
()Returns all edges as a list
count
()Returns the number of edges
explode
()Explodes the edges into a list of edges.
Explodes each edge into a list of edges, one for each layer the edge is part of.
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.
layer
(name)Get edges with the properties of these edges within the specified layer.
layers
(layer_names)Get edges with the properties of these edges within the specified layers.
window
([start, end])Get edges with the properties of these edges within the specific time window.
Attributes:
Returns the date times of exploded edges
Returns all destination nodes as an iterable
Returns the earliest date time of the edges.
Returns the earliest time of the edges.
Get the end time of all edges
Get the end date time of all edges
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 all properties of the edges
Returns all source nodes of the Edges as an iterable.
Get the start time of all edges
Get the start date time of all edges
Returns the times of exploded edges
- after(start)#
Filter edges to only include events after start.
- Parameters:
start (int) – The start time of the window (exclusive).
- Returns:
A list of edges with the window filter applied.
- at(end)#
Get edges with the properties of these edges at a specific time.
- Parameters:
end (int) – The time to get the properties at.
- Returns:
A list of edges with the properties of these edges at a specific time.
- before(end)#
Filter edges to only include events before end.
- Parameters:
end (int) – The end time of the window (exclusive).
- Returns:
A list of edges with the window filter applied.
- collect()#
Returns all edges as a list
- count()#
Returns the number of edges
- date_time#
Returns the date times of exploded edges
- Returns:
A list of date times.
- dst#
Returns all destination nodes as an iterable
- 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#
Get the end time of all edges
Returns: The end time of all edges
- end_date_time#
Get the end date time of all edges
- Returns:
The end date time of all edges
- explode()#
Explodes the edges into a list of edges. This is useful when you want to iterate over the properties of an Edge at every single point in time. This will return a seperate edge each time a property had been changed.
- explode_layers()#
Explodes each edge into a list of edges, one for each layer the edge is part of. This is useful when you want to iterate over the properties of an Edge for every layer.
- history()#
Returns all timestamps of edges, when an edge is added or change to an edge is made.
- Returns:
A list of unix timestamps.
- history_date_time()#
Returns all timestamps of edges, when an edge is added or change to an edge is made.
- Returns:
An list of timestamps.
- id#
Returns all ids of the edges.
- 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)#
Get edges with the properties of these edges within the specified layer.
- Parameters:
name (str) – The name of the layer.
- Returns:
A list of edges with the properties of these edges within the specified layer.
- 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(layer_names)#
Get edges with the properties of these edges within the specified layers.
- Parameters:
layer_names ([str]) – The names of the layers.
- Returns:
A list of edges with the properties of these edges within the specified layers.
- properties#
Returns all properties of the edges
- src#
Returns all source nodes of the Edges as an iterable.
- Returns:
The source nodes of the Edges as an iterable.
- start#
Get the start time of all edges
Returns: The start time of all edges
- start_date_time#
Get the start date time of all edges
Returns: The start date time of all edges
- time#
Returns the times of exploded edges
- Returns:
Time of edge
- window(start=None, end=None)#
Get edges with the properties of these edges within the specific time window.
- Parameters:
start (int | str) – The start time of the window (optional).
end (int | str) – The end time of the window (optional).
- Returns:
A list of edges with the properties of these edges within the specified time window.
- class raphtory.MutableEdge#
Bases:
Edge
Methods:
add_constant_properties
(properties[, layer])add_updates
(t[, properties, layer])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).
expanding
(step)Creates a WindowSet with the given step size using an expanding window.
explode
()Explodes an Edge into a list of PyEdges.
Explodes an Edge into a list of PyEdges, one for each layer the edge is part of.
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.
layer
(name)layers
(layer_names)Get a new Edge with the properties of this Edge within the specified layers.
rolling
(window[, step])Creates a WindowSet with the given window size and optional step using a rolling window.
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.
Get 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 a view of the properties of the edge.
Get 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_updates(t, properties=None, layer=None)#
- after(start)#
Create a view of the edge including all events after start (exclusive).
- Parameters:
start – 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 – 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 – The end time of the window.
- Returns:
A edge object.
- date_time#
Gets the datetime of an exploded edge.
- Returns:
(datetime) the datetime of an exploded edge
- dst#
Get the destination node of the Edge.
- Returns:
The destination node of the Edge.
- earliest_date_time#
Gets of earliest datetime of an edge.
- Returns:
the earliest datetime of an edge
- earliest_time#
Gets the earliest time of an edge.
- Returns:
(int) The earliest time of an edge
- 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.
- 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) – The step size of the window.
- Returns:
A WindowSet object.
- explode()#
Explodes an Edge into a list of PyEdges. This is useful when you want to iterate over the properties of an Edge at every single point in time. This will return a seperate edge each time a property had been changed.
- Returns:
A list of PyEdges
- explode_layers()#
Explodes an Edge into a list of PyEdges, one for each layer the edge is part of. This is useful when you want to iterate over the properties of an Edge for every layer.
- Returns:
A list of PyEdges
- 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.
- history_date_time()#
Returns a list of timestamps of when an edge is added or change to an edge is made.
- Returns:
A list of timestamps.
- id#
The id of the edge.
- latest_date_time#
Gets of latest datetime of an edge.
- Returns:
(datetime) the latest datetime of an edge
- latest_time#
Gets the latest time of an edge.
- Returns:
(int) The latest time of an edge
- layer(name)#
- layer_name#
Gets the name of the layer this edge belongs to - assuming it only belongs to one layer
- Returns:
(List<str>) The name of the layer
- layer_names#
Gets the names of the layers this edge belongs to
- Returns:
(List<str>) The name of the layer
- layers(layer_names)#
Get a new Edge with the properties of this Edge within the specified layers.
- Parameters:
layer_names (List<str>) – Layers to be included in the new edge.
- Returns:
A new Edge with the properties of this Edge within the specified time window.
- 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 – The size of the window.
step – The step size of the window. Defaults to the window size.
- Returns:
A WindowSet object.
- src#
Get the source node of the Edge.
- 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:
(int) The time of an exploded edge
- window(start=None, end=None)#
Create a view of the edge including all events between start (inclusive) and end (exclusive)
- Parameters:
start – The start time of the window. Defaults to the start time of the edge.
end – The end time of the window. Defaults to the end time of the edge.
Returns: r A edge object.
- window_size#
Get the window size (difference between start and end) for this edge