Edge#
- class 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 returns an edge object for each update within the original edge.
Explode layers returns an edge object for each layer within the original edge.
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 the number of times 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) :rtype: bool
Check if the edge is currently deleted :rtype: bool
Check if the edge is on the same node :rtype: bool
is_valid
()Check if the edge is currently valid (i.e., not deleted) :rtype: 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).
- 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).
- date_time#
Gets the datetime of an exploded edge.
- Returns:
the datetime of an exploded edge
- Return type:
- 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
- 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:
- earliest_time#
Gets the earliest time of an edge.
- Returns:
The earliest time of an edge
- Return type:
- end#
Gets the latest time that this Edge is valid.
- end_date_time#
Gets the latest datetime that this Edge is valid
- 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
- 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.
- explode()#
Explodes returns an edge object for each update within the original edge.
- explode_layers()#
Explode layers returns an edge object for each layer within the original edge. These new edge object contains only updates from respective 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.
- history_counts()#
Returns the number of times an edge is added or change to an edge is made.
- Returns:
The number of times an edge is added or change to an edge is made.
- Return type:
- 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) :rtype: bool
- is_deleted()#
Check if the edge is currently deleted :rtype: bool
- is_self_loop()#
Check if the edge is on the same node :rtype: bool
- is_valid()#
Check if the edge is currently valid (i.e., not deleted) :rtype: bool
- latest_date_time#
Gets of latest datetime of an edge.
- Returns:
the latest datetime of an edge
- Return type:
- layer(name)#
Return a view of Edge containing the layer “name” Errors if the layer does not exist
- 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:
- 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.
- 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.
- 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.
This is equivalent to before(time + 1) for Graph and at(time) for PersistentGraph
- 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 Graph and latest() for PersistentGraph
- Return type:
- src#
Returns the source node of the edge.
- start#
Gets the start time for rolling and expanding windows for this Edge
- start_date_time#
Gets the earliest datetime that this Edge is valid
- 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)