NestedEdges
Methods
| Method | Description |
|---|---|
after | Create a view of the NestedEdges including all events after start (exclusive). |
at | Create a view of the NestedEdges including all events at time. |
before | Create a view of the NestedEdges including all events before end (exclusive). |
collect | Collect all edges into a list |
default_layer | Return a view of NestedEdges containing only the default edge layer |
exclude_layer | Return a view of NestedEdges containing all layers except the excluded name |
exclude_layers | Return a view of NestedEdges containing all layers except the excluded names |
exclude_valid_layer | Return a view of NestedEdges containing all layers except the excluded name |
exclude_valid_layers | Return a view of NestedEdges containing all layers except the excluded names |
expanding | 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 | 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 | Check if NestedEdges has the layer "name" |
is_active | Check if the edges are active (there is at least one update during this time). |
is_deleted | Check if edges are deleted. |
is_self_loop | Check if the edges are on the same node. |
is_valid | Check if edges are valid (i.e., not deleted). |
latest | Create a view of the NestedEdges including all events at the latest time. |
layer | Return a view of NestedEdges containing the layer "name" |
layers | Return a view of NestedEdges containing all layers names |
rolling | Creates a WindowSet with the given window size and optional step using a rolling window. |
shrink_end | Set the end of the window to the smaller of end and self.end() |
shrink_start | Set the start of the window to the larger of start and self.start() |
shrink_window | Shrink both the start and end of the window (same as calling shrink_start followed by shrink_end but more efficient) |
snapshot_at | Create a view of the NestedEdges including all events that have not been explicitly deleted at time. |
snapshot_latest | Create a view of the NestedEdges including all events that have not been explicitly deleted at the latest time. |
valid_layers | Return a view of NestedEdges containing all layers names |
window | Create a view of the NestedEdges including all events between start (inclusive) and end (exclusive) |
Properties
| Property | Description |
|---|---|
deletions | Returns a history object for each edge containing their deletion times. |
dst | Returns the destination node of the edge. |
earliest_time | Returns the earliest time of the edges. |
end | Gets the latest time that this NestedEdges is valid. |
history | Returns a history object for each edge containing time entries for when the edge is added or change to the edge is made. |
id | Returns all ids of the edges. |
latest_time | Returns the latest time of the edges. |
layer_name | Returns the name of the layer the edges belong to - assuming they only belong to one layer. |
layer_names | Returns the names of the layers the edges belong to. |
metadata | Get a view of the metadata only. |
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 |
src | Returns the source node of the edge. |
start | Gets the start time for rolling and expanding windows for this NestedEdges |
time | Returns the times of exploded edges. |
window_size | Get the window size (difference between start and end) for this NestedEdges. |
Method Details
after
Signature: after(start)
Create a view of the NestedEdges including all events after start (exclusive).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
start | TimeInput | - | The start time of the window. |
Returns
| Type | Description |
|---|---|
| NestedEdges |
at
Signature: at(time)
Create a view of the NestedEdges including all events at time.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
time | TimeInput | - | The time of the window. |
Returns
| Type | Description |
|---|---|
| NestedEdges |
before
Signature: before(end)
Create a view of the NestedEdges including all events before end (exclusive).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
end | TimeInput | - | The end time of the window. |
Returns
| Type | Description |
|---|---|
| NestedEdges |
collect
Collect all edges into a list
Returns
| Type | Description |
|---|---|
| list[list[Edges]] | the list of edges |
default_layer
Return a view of NestedEdges containing only the default edge layer
Returns
| Type | Description |
|---|---|
| NestedEdges | The layered view |
exclude_layer
Signature: exclude_layer(name)
Return a view of NestedEdges containing all layers except the excluded name
Errors if any of the layers do not exist.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | - | layer name that is excluded for the new view |
Returns
| Type | Description |
|---|---|
| NestedEdges | The layered view |
exclude_layers
Signature: exclude_layers(names)
Return a view of NestedEdges containing all layers except the excluded names
Errors if any of the layers do not exist.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
names | list[str] | - | list of layer names that are excluded for the new view |
Returns
| Type | Description |
|---|---|
| NestedEdges | The layered view |
exclude_valid_layer
Signature: exclude_valid_layer(name)
Return a view of NestedEdges containing all layers except the excluded name
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | - | layer name that is excluded for the new view |
Returns
| Type | Description |
|---|---|
| NestedEdges | The layered view |
exclude_valid_layers
Signature: exclude_valid_layers(names)
Return a view of NestedEdges containing all layers except the excluded names
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
names | list[str] | - | list of layer names that are excluded for the new view |
Returns
| Type | Description |
|---|---|
| NestedEdges | The 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
| Name | Type | Default | Description |
|---|---|---|---|
step | int | str | - | The step size of the window. |
alignment_unit | str | None, optional | None | If 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
| Type | Description |
|---|---|
| WindowSet | A WindowSet object. |
explode
Explodes returns an edge object for each update within the original edge.
Returns
| Type | Description |
|---|---|
| Edges |
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.
Returns
| Type | Description |
|---|---|
| Edges |
has_layer
Signature: has_layer(name)
Check if NestedEdges has the layer "name"
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | - | the name of the layer to check |
Returns
| Type | Description |
|---|---|
| bool |
is_active
Check if the edges are active (there is at least one update during this time).
Returns
| Type | Description |
|---|---|
| NestedBoolIterable |
is_deleted
Check if edges are deleted.
Returns
| Type | Description |
|---|---|
| NestedBoolIterable |
is_self_loop
Check if the edges are on the same node.
Returns
| Type | Description |
|---|---|
| NestedBoolIterable |
is_valid
Check if edges are valid (i.e., not deleted).
Returns
| Type | Description |
|---|---|
| NestedBoolIterable |
latest
Create a view of the NestedEdges including all events at the latest time.
Returns
| Type | Description |
|---|---|
| NestedEdges |
layer
Signature: layer(name)
Return a view of NestedEdges containing the layer "name"
Errors if the layer does not exist
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | - | then name of the layer. |
Returns
| Type | Description |
|---|---|
| NestedEdges | The layered view |
layers
Signature: layers(names)
Return a view of NestedEdges containing all layers names
Errors if any of the layers do not exist.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
names | list[str] | - | list of layer names for the new view |
Returns
| Type | Description |
|---|---|
| NestedEdges | The layered view |
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
| Name | Type | Default | Description |
|---|---|---|---|
window | int | str | - | The size of the window. |
step | int | str | None, optional | None | The step size of the window. step defaults to window. |
alignment_unit | str | None, optional | None | If 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
| Type | Description |
|---|---|
| WindowSet | A WindowSet object. |
shrink_end
Signature: shrink_end(end)
Set the end of the window to the smaller of end and self.end()
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
end | TimeInput | - | the new end time of the window |
Returns
| Type | Description |
|---|---|
| NestedEdges |
shrink_start
Signature: shrink_start(start)
Set the start of the window to the larger of start and self.start()
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
start | TimeInput | - | the new start time of the window |
Returns
| Type | Description |
|---|---|
| NestedEdges |
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
| Name | Type | Default | Description |
|---|---|---|---|
start | TimeInput | - | the new start time for the window |
end | TimeInput | - | the new end time for the window |
Returns
| Type | Description |
|---|---|
| NestedEdges |
snapshot_at
Signature: snapshot_at(time)
Create a view of the NestedEdges 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
| Name | Type | Default | Description |
|---|---|---|---|
time | TimeInput | - | The time of the window. |
Returns
| Type | Description |
|---|---|
| NestedEdges |
snapshot_latest
Create a view of the NestedEdges 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
| Type | Description |
|---|---|
| NestedEdges |
valid_layers
Signature: valid_layers(names)
Return a view of NestedEdges containing all layers names
Any layers that do not exist are ignored
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
names | list[str] | - | list of layer names for the new view |
Returns
| Type | Description |
|---|---|
| NestedEdges | The layered view |
window
Signature: window(start, end)
Create a view of the NestedEdges including all events between start (inclusive) and end (exclusive)
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
start | TimeInput | - | The start time of the window. |
end | TimeInput | - | The end time of the window. |
Returns
| Type | Description |
|---|---|
| NestedEdges |
Property Details
deletions
Returns a history object for each edge containing their deletion times.
Returns
| Type | Description |
|---|---|
| NestedHistoryIterable | A nested iterable of history objects, one for each edge. |
dst
Returns the destination node of the edge.
Returns
| Type | Description |
|---|---|
| Node |
earliest_time
Returns the earliest time of the edges.
Returns
| Type | Description |
|---|---|
| NestedOptionEventTimeIterable | A nested iterable of EventTimes. |
end
Gets the latest time that this NestedEdges is valid.
Returns
| Type | Description |
|---|---|
| OptionalEventTime | The latest time that this NestedEdges is valid or None if the NestedEdges is valid for all times. |
history
Returns a history object for each edge containing time entries for when the edge is added or change to the edge is made.
Returns
| Type | Description |
|---|---|
| NestedHistoryIterable | A nested iterable of history objects, one for each edge. |
id
Returns all ids of the edges.
Returns
| Type | Description |
|---|---|
| NestedGIDGIDIterable |
latest_time
Returns the latest time of the edges.
Returns
| Type | Description |
|---|---|
| NestedOptionEventTimeIterable | A nested iterable of EventTimes. |
layer_name
Returns the name of the layer the edges belong to - assuming they only belong to one layer.
Returns
| Type | Description |
|---|---|
| NestedArcStringIterable |
layer_names
Returns the names of the layers the edges belong to.
Returns
| Type | Description |
|---|---|
| NestedArcStringVecIterable |
metadata
Get a view of the metadata only.
Returns
| Type | Description |
|---|---|
| MetadataListList |
nbr
Returns the node at the other end of the edge (same as dst() for out-edges and src() for in-edges)
Returns
| Type | Description |
|---|---|
| Nodes |
properties
Returns all properties of the edges
Returns
| Type | Description |
|---|---|
| PyNestedPropsIterable |
src
Returns the source node of the edge.
Returns
| Type | Description |
|---|---|
| Nodes |
start
Gets the start time for rolling and expanding windows for this NestedEdges
Returns
| Type | Description |
|---|---|
| OptionalEventTime | The earliest time that this NestedEdges is valid or None if the NestedEdges is valid for all times. |
time
Returns the times of exploded edges.
Returns
| Type | Description |
|---|---|
| NestedEventTimeIterable | A nested iterable of EventTimes. |
window_size
Get the window size (difference between start and end) for this NestedEdges.
Returns
| Type | Description |
|---|---|
| int, optional |