Raphtory#
Raphtory graph analytics library
Classes:
A view of constant properties of an entity |
|
PyEdge is a Python class that represents an edge in the graph. |
|
A list of edges that can be iterated over. |
|
A temporal graph. |
|
A temporal graph. |
|
A view of the properties of an entity |
|
A view of a temporal property |
|
A view of the temporal properties of an entity |
|
A vertex (or node) in the graph. |
|
A list of vertices that can be iterated over. |
- class raphtory.AlgorithmResultStrU64#
Bases:
object
Methods:
get
(key)Returns the value corresponding to the provided key in the result hashmap.
get_all
()Returns a reference to the entire result hashmap.
group_by
()Groups the AlgorithmResult by its values.
sort_by_key
([reverse])Sorts the AlgorithmResult by its keys in ascending or descending order.
sort_by_value
([reverse])Sorts the AlgorithmResult by its values in ascending or descending order.
to_df
()Creates a dataframe from the result
top_k
(k[, percentage, reverse])Retrieves the top-k elements from the AlgorithmResult based on its values.
- get(key)#
Returns the value corresponding to the provided key in the result hashmap.
# Arguments
key: The key of type H for which the value is to be retrieved.
- get_all()#
Returns a reference to the entire result hashmap.
- group_by()#
Groups the AlgorithmResult by its values.
# Returns
A HashMap where keys are unique values from the AlgorithmResult and values are vectors containing keys of type H that share the same value.
- sort_by_key(reverse=Ellipsis)#
Sorts the AlgorithmResult by its keys in ascending or descending order.
# Arguments
reverse: If true, sorts the result in descending order; otherwise, sorts in ascending order.
# Returns
A sorted vector of tuples containing keys of type H and values of type Y.
- sort_by_value(reverse=Ellipsis)#
Sorts the AlgorithmResult by its values in ascending or descending order.
# Arguments
reverse: If true, sorts the result in descending order; otherwise, sorts in ascending order.
# Returns
A sorted vector of tuples containing keys of type H and values of type Y.
- to_df()#
Creates a dataframe from the result
# Returns
A pandas.DataFrame containing the result
- top_k(k, percentage=Ellipsis, reverse=Ellipsis)#
Retrieves the top-k elements from the AlgorithmResult based on its values.
# Arguments
k: The number of elements to retrieve.
percentage: If true, the k parameter is treated as a percentage of total elements.
reverse: If true, retrieves the elements in descending order; otherwise, in ascending order.
# Returns
An Option containing a vector of tuples with keys of type H and values of type Y. If percentage is true, the returned vector contains the top k percentage of elements. If percentage is false, the returned vector contains the top k elements. Returns None if the result is empty or if k is 0.
- class raphtory.ConstProperties#
Bases:
object
A view of constant properties of an entity
Methods:
as_dict
()convert the properties view to a python dict
get
(key)- param key:
the name of the property
items
()lists the property keys together with the corresponding value
keys
()lists the available property keys
values
()lists the property values
- 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 vertices.
Methods:
at
(end)Get a new Edge with the properties of this Edge at a specified time.
Gets the datetime of an exploded edge.
dst
()Get the destination vertex of the Edge.
Gets of earliest datetime of an edge.
Gets the earliest time of an edge.
end
()Get the end time of the Edge.
Get the end datetime of the Edge.
expanding
(step)Get the duration of the Edge.
explode
()Explodes an Edge into a list of PyEdges.
history
()Returns a list of timestamps of when an edge is added or change to an edge is made.
id
()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
layers
(layer_names)Get a new Edge with the properties of this Edge within the specified layers.
rolling
(window[, step])Get a set of Edge windows for a given window size, step, start time and end time using rolling window.
src
()Get the source vertex of the Edge.
start
()Get the start time of the Edge.
Get the start datetime of the Edge.
time
()Gets the time of an exploded edge.
window
([t_start, t_end])Get a new Edge with the properties of this Edge within the specified time window.
Attributes:
Returns a view of the properties of the edge.
- at(end)#
Get a new Edge with the properties of this Edge at a specified time.
- Parameters:
end (int) – The time to get the properties at.
- Returns:
A new Edge with the properties of this Edge at a specified time.
- date_time()#
Gets the datetime of an exploded edge.
- Returns:
(datetime) the datetime of an exploded edge
- dst()#
Get the destination vertex of the Edge.
- Returns:
The destination vertex 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()#
Get the end time of the Edge.
- Returns:
The end time of the Edge.
- end_date_time()#
Get the end datetime of the Edge.
- Returns:
The end datetime of the Edge
- expanding(step)#
Get the duration of the Edge.
- Parameters:
step (int) – The step size to use when calculating the duration.
- Returns:
A set of windows containing edges that fall in the time period
- 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
- history()#
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:
the latest datetime of an edge
- latest_time()#
Gets the latest time of an edge.
- Returns:
(int) The latest time of an edge
- layer_names()#
Gets the name of the layer this edge belongs to
- Returns:
(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 ([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.
- rolling(window, step=Ellipsis)#
Get a set of Edge windows for a given window size, step, start time and end time using rolling window. A rolling window is a window that moves forward by step size at each iteration.
- src()#
Get the source vertex of the Edge.
- Returns:
The source vertex of the Edge.
- start()#
Get the start time of the Edge.
- Returns:
The start time of the Edge.
- start_date_time()#
Get the start datetime of the Edge.
- Returns:
the start datetime of the Edge.
- time()#
Gets the time of an exploded edge.
- Returns:
(int) The time of an exploded edge
- window(t_start=Ellipsis, t_end=Ellipsis)#
Get a new Edge with the properties of this Edge within the specified time window.
- class raphtory.Edges#
Bases:
object
A list of edges that can be iterated over.
Methods:
collect
()Returns all edges as a list
count
()Returns the number of edges
dst
()Returns all destination vertices as an iterable
Returns the earliest time of the edges.
explode
()Explodes the edges into a list of edges.
first
()Returns the first edge
id
()Returns all ids of the edges.
Returns the latest time of the edges.
src
()Returns all source vertices of the Edges as an iterable.
Attributes:
Returns all properties of the edges
- collect()#
Returns all edges as a list
- count()#
Returns the number of edges
- dst()#
Returns all destination vertices as an iterable
- earliest_time()#
Returns the earliest time of the 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.
- first()#
Returns the first edge
- id()#
Returns all ids of the edges.
- latest_time()#
Returns the latest time of the edges.
- properties#
Returns all properties of the edges
- src()#
Returns all source vertices of the Edges as an iterable.
- Returns:
The source vertices of the Edges as an iterable.
- class raphtory.Graph#
Bases:
GraphView
A temporal graph.
Methods:
add_edge
(timestamp, src, dst[, properties, ...])Adds a new edge with the given source and destination vertices and properties to the graph.
add_edge_properties
(src, dst, properties[, ...])Adds properties to an existing edge.
add_property
(timestamp, properties)Adds properties to the graph.
add_static_property
(properties)Adds static properties to the graph.
add_vertex
(timestamp, id[, properties])Adds a new vertex with the given id and properties to the graph.
add_vertex_properties
(self, id, properties)Adds properties to an existing vertex.
at
(end)Create a view including all events until end (inclusive)
Create a view including all the edges in the default layer
DateTime of earliest activity in the graph
Timestamp of earliest activity in the graph
edge
(src, dst)Gets the edge with the specified source and destination vertices
edges
()Gets all edges in the graph
end
()Returns the default end time for perspectives over the view
Returns the default end datetime for perspectives over the view
expanding
(step)Creates a WindowSet with the given step size and optional start and end times, using an expanding window.
Return all the layer ids in the graph
has_edge
(src, dst[, layer])Returns true if the graph contains the specified edge
has_vertex
(id)Returns true if the graph contains the specified vertex
DateTime of latest activity in the graph
Timestamp of latest activity in the graph
layer
(name)Create a view including all the edges in the layers names
layers
(names)Create a view including all the edges in the layers names
load_edge_props_from_pandas
(edge_df[, ...])load_edges_from_pandas
(edge_df[, src_col, ...])load_from_file
(path)Loads a graph from the given path.
load_from_pandas
(edges_df[, src, dst, time, ...])load_vertex_props_from_pandas
(vertices_df[, ...])load_vertices_from_pandas
(vertices_df[, ...])Returns a graph clone
Number of edges in the graph
Number of vertices in the graph
rolling
(window[, step])Creates a WindowSet with the given window size and optional step, start and end times, using a rolling window.
save_to_file
(path)Saves the graph to the given path.
start
()Returns the default start time for perspectives over the view
Returns the default start datetime for perspectives over the view
subgraph
(vertices)Returns a subgraph given a set of vertices
vertex
(id)Gets the vertex with the specified id
window
([start, end])Create a view including all events between t_start (inclusive) and t_end (exclusive)
Returns the size of the window covered by this view
Attributes:
Get all graph properties
Gets the vertices in the graph
- add_edge(timestamp, src, dst, properties=Ellipsis, layer=Ellipsis)#
Adds a new edge with the given source and destination vertices and properties to the graph.
- add_edge_properties(src, dst, properties, layer=Ellipsis)#
Adds properties to an existing edge.
- add_property(timestamp, properties)#
Adds properties to the graph.
- add_static_property(properties)#
Adds static properties to the graph.
- Parameters:
properties (dict) – The static properties of the graph.
- Returns:
None
- add_vertex(timestamp, id, properties=Ellipsis)#
Adds a new vertex with the given id and properties to the graph.
- add_vertex_properties(self, id: str | int, properties: dict) None #
Adds properties to an existing vertex.
- at(end)#
Create a view including all events until end (inclusive)
- Parameters:
end (int) – the end time of the window
- Returns:
a view including all events until end (inclusive)
- default_layer()#
Create a view including all the edges in the default layer
- Returns:
a view including all the edges in the default layer
- earliest_date_time()#
DateTime of earliest activity in the graph
- Returns:
the datetime of the earliest activity in the graph
- earliest_time()#
Timestamp of earliest activity in the graph
- Returns:
the timestamp of the earliest activity in the graph
- edge(src, dst)#
Gets the edge with the specified source and destination vertices
- edges()#
Gets all edges in the graph
- Returns:
the edges in the graph
- end()#
Returns the default end time for perspectives over the view
- Returns:
the default end time for perspectives over the view
- end_date_time()#
Returns the default end datetime for perspectives over the view
- Returns:
the default end datetime for perspectives over the view
- expanding(step)#
Creates a WindowSet with the given step size and optional start and end times, using an expanding window.
An expanding window is a window that grows by step size at each iteration.
- get_unique_layers()#
Return all the layer ids in the graph
- has_edge(src, dst, layer=Ellipsis)#
Returns true if the graph contains the specified edge
- has_vertex(id)#
Returns true if the graph contains the specified vertex
- latest_date_time()#
DateTime of latest activity in the graph
- Returns:
the datetime of the latest activity in the graph
- latest_time()#
Timestamp of latest activity in the graph
- Returns:
the timestamp of the latest activity in the graph
- layer(name)#
Create a view including all the edges in the layers names
- Parameters:
names (str) – the names of the layers to include
- Returns:
a view including all the edges in the layers names
- layers(names)#
Create a view including all the edges in the layers names
- Parameters:
names (str) – the names of the layers to include
- Returns:
a view including all the edges in the layers names
- load_edge_props_from_pandas(edge_df, src_col=Ellipsis, dst_col=Ellipsis, const_props=Ellipsis, shared_const_props=Ellipsis, layer=Ellipsis, layer_in_df=Ellipsis)#
- load_edges_from_pandas(edge_df, src_col=Ellipsis, dst_col=Ellipsis, time_col=Ellipsis, props=Ellipsis, const_props=Ellipsis, shared_const_props=Ellipsis, layer=Ellipsis, layer_in_df=Ellipsis)#
- static load_from_file(path)#
Loads a graph from the given path.
- static load_from_pandas(edges_df, src=Ellipsis, dst=Ellipsis, time=Ellipsis, props=Ellipsis, const_props=Ellipsis, shared_const_props=Ellipsis, layer=Ellipsis, layer_in_df=Ellipsis, vertex_df=Ellipsis, vertex_col=Ellipsis, vertex_time_col=Ellipsis, vertex_props=Ellipsis, vertex_const_props=Ellipsis, vertex_shared_const_props=Ellipsis)#
- load_vertex_props_from_pandas(vertices_df, vertex_col=Ellipsis, const_props=Ellipsis, shared_const_props=Ellipsis)#
- load_vertices_from_pandas(vertices_df, vertex_col=Ellipsis, time_col=Ellipsis, props=Ellipsis, const_props=Ellipsis, shared_const_props=Ellipsis)#
- materialize()#
Returns a graph clone
Arguments:
- Returns:
GraphView - Returns a graph clone
- num_edges()#
Number of edges in the graph
- Returns:
the number of edges in the graph
- num_vertices()#
Number of vertices in the graph
- Returns:
the number of vertices in the graph
- properties#
Get all graph properties
- Returns:
HashMap<String, Prop> - Properties paired with their names
- rolling(window, step=Ellipsis)#
Creates a WindowSet with the given window size and optional step, start and end times, using a rolling window.
A rolling window is a window that moves forward by step size at each iteration.
- save_to_file(path)#
Saves the graph to the given path.
- Parameters:
path (str) – The path to the graph.
Returns: None
- start()#
Returns the default start time for perspectives over the view
- Returns:
the default start time for perspectives over the view
- start_date_time()#
Returns the default start datetime for perspectives over the view
- Returns:
the default start datetime for perspectives over the view
- subgraph(vertices)#
Returns a subgraph given a set of vertices
- Parameters:
vertices (*) – set of vertices
- Returns:
GraphView - Returns the subgraph
- vertex(id)#
Gets the vertex with the specified id
- vertices#
Gets the vertices in the graph
- Returns:
the vertices in the graph
- window(start=Ellipsis, end=Ellipsis)#
Create a view including all events between t_start (inclusive) and t_end (exclusive)
- class raphtory.GraphWithDeletions#
Bases:
GraphView
A temporal graph.
Methods:
add_edge
(timestamp, src, dst[, properties, ...])Adds a new edge with the given source and destination vertices and properties to the graph.
add_edge_properties
(src, dst, properties[, ...])Adds properties to an existing edge.
add_property
(timestamp, properties)Adds properties to the graph.
add_static_property
(properties)Adds static properties to the graph.
add_vertex
(timestamp, id[, properties])Adds a new vertex with the given id and properties to the graph.
add_vertex_properties
(id, properties)Adds properties to an existing vertex.
at
(end)Create a view including all events until end (inclusive)
Create a view including all the edges in the default layer
delete_edge
(timestamp, src, dst[, layer])Deletes an edge given the timestamp, src and dst vertices and layer (optional)
DateTime of earliest activity in the graph
Timestamp of earliest activity in the graph
edge
(src, dst)Gets the edge with the specified source and destination vertices
edges
()Gets all edges in the graph
end
()Returns the default end time for perspectives over the view
Returns the default end datetime for perspectives over the view
expanding
(step)Creates a WindowSet with the given step size and optional start and end times, using an expanding window.
Return all the layer ids in the graph
has_edge
(src, dst[, layer])Returns true if the graph contains the specified edge
has_vertex
(id)Returns true if the graph contains the specified vertex
DateTime of latest activity in the graph
Timestamp of latest activity in the graph
layer
(name)Create a view including all the edges in the layers names
layers
(names)Create a view including all the edges in the layers names
load_from_file
(path)Loads a graph from the given path.
Returns a graph clone
Number of edges in the graph
Number of vertices in the graph
rolling
(window[, step])Creates a WindowSet with the given window size and optional step, start and end times, using a rolling window.
save_to_file
(path)Saves the graph to the given path.
start
()Returns the default start time for perspectives over the view
Returns the default start datetime for perspectives over the view
subgraph
(vertices)Returns a subgraph given a set of vertices
vertex
(id)Gets the vertex with the specified id
window
([start, end])Create a view including all events between t_start (inclusive) and t_end (exclusive)
Returns the size of the window covered by this view
Attributes:
Get all graph properties
Gets the vertices in the graph
- add_edge(timestamp, src, dst, properties=Ellipsis, layer=Ellipsis)#
Adds a new edge with the given source and destination vertices and properties to the graph.
- add_edge_properties(src, dst, properties, layer=Ellipsis)#
Adds properties to an existing edge.
- add_property(timestamp, properties)#
Adds properties to the graph.
- add_static_property(properties)#
Adds static properties to the graph.
- Parameters:
properties (dict) – The static properties of the graph.
- Returns:
None
- add_vertex(timestamp, id, properties=Ellipsis)#
Adds a new vertex with the given id and properties to the graph.
- add_vertex_properties(id, properties)#
Adds properties to an existing vertex.
- at(end)#
Create a view including all events until end (inclusive)
- Parameters:
end (int) – the end time of the window
- Returns:
a view including all events until end (inclusive)
- default_layer()#
Create a view including all the edges in the default layer
- Returns:
a view including all the edges in the default layer
- delete_edge(timestamp, src, dst, layer=Ellipsis)#
Deletes an edge given the timestamp, src and dst vertices and layer (optional)
- earliest_date_time()#
DateTime of earliest activity in the graph
- Returns:
the datetime of the earliest activity in the graph
- earliest_time()#
Timestamp of earliest activity in the graph
- Returns:
the timestamp of the earliest activity in the graph
- edge(src, dst)#
Gets the edge with the specified source and destination vertices
- edges()#
Gets all edges in the graph
- Returns:
the edges in the graph
- end()#
Returns the default end time for perspectives over the view
- Returns:
the default end time for perspectives over the view
- end_date_time()#
Returns the default end datetime for perspectives over the view
- Returns:
the default end datetime for perspectives over the view
- expanding(step)#
Creates a WindowSet with the given step size and optional start and end times, using an expanding window.
An expanding window is a window that grows by step size at each iteration.
- get_unique_layers()#
Return all the layer ids in the graph
- has_edge(src, dst, layer=Ellipsis)#
Returns true if the graph contains the specified edge
- has_vertex(id)#
Returns true if the graph contains the specified vertex
- latest_date_time()#
DateTime of latest activity in the graph
- Returns:
the datetime of the latest activity in the graph
- latest_time()#
Timestamp of latest activity in the graph
- Returns:
the timestamp of the latest activity in the graph
- layer(name)#
Create a view including all the edges in the layers names
- Parameters:
names (str) – the names of the layers to include
- Returns:
a view including all the edges in the layers names
- layers(names)#
Create a view including all the edges in the layers names
- Parameters:
names (str) – the names of the layers to include
- Returns:
a view including all the edges in the layers names
- static load_from_file(path)#
Loads a graph from the given path.
- materialize()#
Returns a graph clone
Arguments:
- Returns:
GraphView - Returns a graph clone
- num_edges()#
Number of edges in the graph
- Returns:
the number of edges in the graph
- num_vertices()#
Number of vertices in the graph
- Returns:
the number of vertices in the graph
- properties#
Get all graph properties
- Returns:
HashMap<String, Prop> - Properties paired with their names
- rolling(window, step=Ellipsis)#
Creates a WindowSet with the given window size and optional step, start and end times, using a rolling window.
A rolling window is a window that moves forward by step size at each iteration.
- save_to_file(path)#
Saves the graph to the given path.
- Parameters:
path (str) – The path to the graph.
Returns: None
- start()#
Returns the default start time for perspectives over the view
- Returns:
the default start time for perspectives over the view
- start_date_time()#
Returns the default start datetime for perspectives over the view
- Returns:
the default start datetime for perspectives over the view
- subgraph(vertices)#
Returns a subgraph given a set of vertices
- Parameters:
vertices (*) – set of vertices
- Returns:
GraphView - Returns the subgraph
- vertex(id)#
Gets the vertex with the specified id
- vertices#
Gets the vertices in the graph
- Returns:
the vertices in the graph
- window(start=Ellipsis, end=Ellipsis)#
Create a view including all events between t_start (inclusive) and t_end (exclusive)
- class raphtory.Properties#
Bases:
object
A view of the properties of an entity
Methods:
as_dict
()Convert properties view to a dict
get
(key)Get property value.
items
()Get a list of key-value pairs
keys
()Get the names for all properties (includes temporal and static properties)
values
()Get the values of the properties
Attributes:
Get a view of the constant properties (meta-data) only.
Get a view of the temporal properties only.
- as_dict()#
Convert properties view to a dict
- constant#
Get a view of the constant properties (meta-data) only.
- get(key)#
Get property value.
First searches temporal properties and returns latest value if it exists. If not, it falls back to static properties.
- items()#
Get a list of key-value pairs
- keys()#
Get the names for all properties (includes temporal and static properties)
- temporal#
Get a view of the temporal properties only.
- values()#
Get the values of the properties
If a property exists as both temporal and static, temporal properties take priority with fallback to the static property if the temporal value does not exist.
- class raphtory.TemporalProp#
Bases:
object
A view of a temporal property
Methods:
at
(t)Get the value of the property at time t
average
()count
()history
()Get the timestamps at which the property was updated
items
()List update timestamps and corresponding property values
len
()max
()mean
()median
()min
()sum
()value
()Get the latest value of the property
values
()Get the property values for each update
- at(t)#
Get the value of the property at time t
- average()#
- count()#
- history()#
Get the timestamps at which the property was updated
- items()#
List update timestamps and corresponding property values
- len()#
- max()#
- mean()#
- median()#
- min()#
- sum()#
- value()#
Get the latest value of the property
- values()#
Get the property values for each update
- class raphtory.TemporalProperties#
Bases:
object
A view of the temporal properties of an entity
Methods:
get
(key)Get property value for key if it exists
Get the histories of all properties
items
()List the property keys together with the corresponding values
keys
()List the available property keys
latest
()Get the latest value of all properties
values
()List the values of the properties
- get(key: str) TemporalProp | None #
Get property value for key if it exists
- Returns:
the property view if it exists, otherwise None
- Return type:
TemporalProp | None
- histories()#
Get the histories of all properties
- items()#
List the property keys together with the corresponding values
- keys()#
List the available property keys
- latest()#
Get the latest value of all properties
- values()#
List the values of the properties
- Returns:
the list of property views
- Return type:
- class raphtory.Vertex#
Bases:
object
A vertex (or node) in the graph.
Methods:
at
(end)Create a view of the vertex including all events at t.
Create a view including all the edges in the default layer
degree
()Get the degree of this vertex (i.e., the number of edges that are incident to it).
Returns the earliest datetime that the vertex exists.
Returns the earliest time that the vertex exists.
edges
()Get the edges that are pointing to or from this vertex.
end
()Gets the latest time that this vertex is valid.
Gets the latest datetime that this vertex is valid
expanding
(step)Creates a PyVertexWindowSet with the given step size and optional start and end times, using an expanding window.
history
()Returns the history of a vertex, including vertex additions and changes made to vertex.
id
()Returns the id of the vertex.
Get the in-degree of this vertex (i.e., the number of edges that are incident to it from other vertices).
in_edges
()Get the edges that are pointing to this vertex.
Get the neighbours of this vertex that are pointing to it.
Returns the latest datetime that the vertex exists.
Returns the latest time that the vertex exists.
layer
(name)Create a view including all the edges in the layers names
layers
(names)Create a view including all the edges in the layers names
name
()Returns the name of the vertex.
Get the neighbours of this vertex.
Get the out-degree of this vertex (i.e., the number of edges that are incident to it from this vertex).
Get the edges that are pointing from this vertex.
Get the neighbours of this vertex that are pointing from it.
rolling
(window[, step])Creates a PyVertexWindowSet with the given window size and optional step, start and end times, using a rolling window.
start
()Gets the earliest time that this vertex is valid.
Gets the earliest datetime that this vertex is valid
window
([t_start, t_end])Create a view of the vertex including all events between t_start (inclusive) and t_end (exclusive)
Attributes:
The properties of the vertex
- at(end)#
Create a view of the vertex including all events at t.
- Parameters:
end (int) – The time of the window.
- Returns:
A PyVertex object.
- default_layer()#
Create a view including all the edges in the default layer
- Returns:
a view including all the edges in the default layer
- degree()#
Get the degree of this vertex (i.e., the number of edges that are incident to it).
- Returns
The degree of this vertex.
- earliest_date_time()#
Returns the earliest datetime that the vertex exists.
- Parameters:
None –
- Returns:
The earliest datetime that the vertex exists as an integer.
- earliest_time()#
Returns the earliest time that the vertex exists.
- Parameters:
None –
- Returns:
The earliest time that the vertex exists as an integer.
- edges()#
Get the edges that are pointing to or from this vertex.
- Returns:
A list of Edge objects.
- end()#
Gets the latest time that this vertex is valid.
- Returns:
The latest time that this vertex is valid or None if the vertex is valid for all times.
- end_date_time()#
Gets the latest datetime that this vertex is valid
- Returns:
The latest datetime that this vertex is valid or None if the vertex is valid for all times.
- expanding(step)#
Creates a PyVertexWindowSet with the given step size and optional start and end times, using an expanding window.
An expanding window is a window that grows by step size at each iteration. This will tell you whether a vertex exists at different points in the window and what its properties are at those points.
- history()#
Returns the history of a vertex, including vertex additions and changes made to vertex.
- Returns:
A list of timestamps of the event history of vertex.
- id()#
Returns the id of the vertex. This is a unique identifier for the vertex.
- Returns:
The id of the vertex as an integer.
- in_degree()#
Get the in-degree of this vertex (i.e., the number of edges that are incident to it from other vertices).
- Returns:
The in-degree of this vertex.
- in_edges()#
Get the edges that are pointing to this vertex.
- Returns:
A list of Edge objects.
- in_neighbours()#
Get the neighbours of this vertex that are pointing to it.
- Returns:
A list of Vertex objects.
- latest_date_time()#
Returns the latest datetime that the vertex exists.
- Parameters:
None –
- Returns:
The latest datetime that the vertex exists as an integer.
- latest_time()#
Returns the latest time that the vertex exists.
- Returns:
The latest time that the vertex exists as an integer.
- layer(name)#
Create a view including all the edges in the layers names
- Parameters:
names (str) – the names of the layers to include
- Returns:
a view including all the edges in the layers names
- layers(names)#
Create a view including all the edges in the layers names
- Parameters:
names (str) – the names of the layers to include
- Returns:
a view including all the edges in the layers names
- name()#
Returns the name of the vertex.
- Returns:
The name of the vertex as a string.
- neighbours()#
Get the neighbours of this vertex.
- Returns:
A list of Vertex objects.
- out_degree()#
Get the out-degree of this vertex (i.e., the number of edges that are incident to it from this vertex).
- Returns:
The out-degree of this vertex.
- out_edges()#
Get the edges that are pointing from this vertex.
- Returns:
A list of Edge objects.
- out_neighbours()#
Get the neighbours of this vertex that are pointing from it.
- Returns:
A list of Vertex objects.
- properties#
The properties of the vertex
- rolling(window, step=Ellipsis)#
Creates a PyVertexWindowSet with the given window size and optional step, start and end times, using a rolling window.
A rolling window is a window that moves forward by step size at each iteration. This will tell you whether a vertex exists at different points in the window and what its properties are at those points.
- Parameters:
window – The size of the window.
step – The step size of the window. Defaults to the window size.
start – The start time of the window. Defaults to the start time of the vertex.
end – The end time of the window. Defaults to the end time of the vertex.
Returns: A PyVertexWindowSet object.
- start()#
Gets the earliest time that this vertex is valid.
- Returns:
The earliest time that this vertex is valid or None if the vertex is valid for all times.
- start_date_time()#
Gets the earliest datetime that this vertex is valid
- Returns:
The earliest datetime that this vertex is valid or None if the vertex is valid for all times.
- window(t_start=Ellipsis, t_end=Ellipsis)#
Create a view of the vertex including all events between t_start (inclusive) and t_end (exclusive)
- class raphtory.Vertices#
Bases:
object
A list of vertices that can be iterated over.
Methods:
at
(end)Create a view of the vertices including all events at t.
collect
()Collects all vertices into a list
Create a view including all the edges in the default layer
degree
()Returns the number of edges of the vertices
Returns an iterator over the vertices earliest time
edges
()Returns the edges of the vertices
end
()Returns the end time of the vertices
expanding
(step)Creates a PyVertexWindowSet with the given step size using an expanding window.
id
()Returns an iterator over the vertices ids
Returns the number of in edges of the vertices
in_edges
()Returns the in edges of the vertices
Get the in neighbours of the vertices
Returns an iterator over the vertices latest time
layer
(name)Create a view including all the edges in the layers names
name
()Returns an iterator over the vertices name
Get the neighbours of the vertices
Returns the number of out edges of the vertices
Returns the out edges of the vertices
Get the out neighbours of the vertices
rolling
(window[, step])Creates a PyVertexWindowSet with the given window size and optional step using a rolling window.
start
()Returns the start time of the vertices
window
([t_start, t_end])Create a view of the vertices including all events between t_start (inclusive) and t_end (exclusive)
Returns the size of the window covered by this view
Attributes:
- at(end)#
Create a view of the vertices including all events at t.
- Parameters:
end (int) – The time of the window.
- Returns:
A PyVertices object.
- collect()#
Collects all vertices into a list
- default_layer()#
Create a view including all the edges in the default layer
- Returns:
a view including all the edges in the default layer
- degree()#
Returns the number of edges of the vertices
- Returns:
An iterator of the number of edges of the vertices
- earliest_time()#
Returns an iterator over the vertices earliest time
- edges()#
Returns the edges of the vertices
- Returns:
An iterator of edges of the vertices
- end()#
Returns the end time of the vertices
- expanding(step)#
Creates a PyVertexWindowSet with the given step size using an expanding window.
An expanding window is a window that grows by step size at each iteration. This will tell you whether a vertex exists at different points in the window and what its properties are at those points.
- Parameters:
window (step - The step size of the) –
- Returns:
A PyVertexWindowSet with the given step size and optional start and end times or an error
- id()#
Returns an iterator over the vertices ids
- in_degree()#
Returns the number of in edges of the vertices
- Returns:
An iterator of the number of in edges of the vertices
- in_edges()#
Returns the in edges of the vertices
- Returns:
An iterator of in edges of the vertices
- in_neighbours()#
Get the in neighbours of the vertices
- Returns:
An iterator of the in neighbours of the vertices
- latest_time()#
Returns an iterator over the vertices latest time
- layer(name)#
Create a view including all the edges in the layers names
- Parameters:
names (str) – the names of the layers to include
- Returns:
a view including all the edges in the layers names
- name()#
Returns an iterator over the vertices name
- neighbours()#
Get the neighbours of the vertices
- Returns:
An iterator of the neighbours of the vertices
- out_degree()#
Returns the number of out edges of the vertices
- Returns:
An iterator of the number of out edges of the vertices
- out_edges()#
Returns the out edges of the vertices
- Returns:
An iterator of out edges of the vertices
- out_neighbours()#
Get the out neighbours of the vertices
- Returns:
An iterator of the out neighbours of the vertices
- properties#
- rolling(window, step=Ellipsis)#
Creates a PyVertexWindowSet 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. This will tell you whether a vertex exists at different points in the window and what its properties are at those points.
- Parameters:
window (step - The step size of the) –
window –
- Returns:
A PyVertexWindowSet with the given window size and optional step size or an error
- start()#
Returns the start time of the vertices
- window(t_start=Ellipsis, t_end=Ellipsis)#
Create a view of the vertices including all events between t_start (inclusive) and t_end (exclusive)
- Parameters:
window (t_end - The end time of the) –
window –
- Returns:
A PyVertices object.
Algorithms#
Algorithmic functions that can be run on Raphtory graphs
Functions:
Local reciprocity - measure of the symmetry of relationships associated with a vertex |
|
The average (undirected) degree of all vertices in the graph. |
|
|
Sums the weights of edges in the graph based on the specified direction. |
Graph density - measures how dense or sparse a graph is. |
|
Computes the global clustering coefficient of a graph. |
|
Reciprocity - measure of the symmetry of relationships in a graph, the global reciprocity of the entire graph. |
|
|
Computes the number of three edge, up-to-three node delta-temporal motifs in the graph, using the algorithm of Paranjape et al, Motifs in Temporal Networks (2017). |
|
HITS (Hubs and Authority) Algorithm: AuthScore of a vertex (A) = Sum of HubScore of all vertices pointing at vertex (A) from previous iteration / Sum of HubScore of all vertices in the current iteration |
Local clustering coefficient - measures the degree to which nodes in a graph tend to cluster together. |
|
|
Computes the number of each type of motif that each node participates in. |
|
Local triangle count - calculates the number of triangles (a cycle of length 3) a vertex participates in. |
The maximum in degree of any vertex in the graph. |
|
The maximum out degree of any vertex in the graph. |
|
The minimum in degree of any vertex in the graph. |
|
The minimum out degree of any vertex in the graph. |
|
|
Pagerank -- pagerank centrality value of the vertices in a graph |
|
Temporally reachable nodes -- the nodes that are reachable by a time respecting path followed out from a set of seed nodes at a starting time. |
Computes the number of connected triplets within a graph |
|
|
Weakly connected components -- partitions the graph into node sets which are mutually reachable by an undirected path |
- raphtory.algorithms.all_local_reciprocity(g)#
Local reciprocity - measure of the symmetry of relationships associated with a vertex
This measures the proportion of a vertex’s outgoing edges which are reciprocated with an incoming edge.
- Parameters:
g (Raphtory graph) – a directed Raphtory graph
- Returns:
AlgorithmResult with string keys and float values mapping each vertex name to its reciprocity value.
- Return type:
AlgorithmResult
- raphtory.algorithms.average_degree(g)#
The average (undirected) degree of all vertices in the graph.
Note that this treats the graph as simple and undirected and is equal to twice the number of undirected edges divided by the number of nodes.
- Parameters:
g (Raphtory graph) – a Raphtory graph
- Returns:
the average degree of the nodes in the graph
- Return type:
- raphtory.algorithms.balance(g, name=Ellipsis, direction=Ellipsis, threads=Ellipsis)#
Sums the weights of edges in the graph based on the specified direction.
This function computes the sum of edge weights based on the direction provided, and can be executed in parallel using a given number of threads.
# Parameters * g (&PyGraphView): The graph view on which the operation is to be performed. * name (String, default = “weight”): The name of the edge property used as the weight. Defaults to “weight” if not provided. * direction (PyDirection, default = PyDirection::new(“BOTH”)): Specifies the direction of the edges to be considered for summation.
PyDirection::new(“OUT”): Only consider outgoing edges.
PyDirection::new(“IN”): Only consider incoming edges.
PyDirection::new(“BOTH”): Consider both outgoing and incoming edges. This is the default.
threads (Option<usize>, default = None): The number of threads to be used for parallel execution. Defaults to single-threaded operation if not provided.
# Returns AlgorithmResult<String, OrderedFloat<f64>>: A result containing a mapping of vertex names to the computed sum of their associated edge weights.
- raphtory.algorithms.directed_graph_density(g)#
Graph density - measures how dense or sparse a graph is.
The ratio of the number of directed edges in the graph to the total number of possible directed edges (given by N * (N-1) where N is the number of nodes).
- Parameters:
g (Raphtory graph) – a directed Raphtory graph
- Returns:
Directed graph density of G.
- Return type:
- raphtory.algorithms.global_clustering_coefficient(g)#
Computes the global clustering coefficient of a graph. The global clustering coefficient is defined as the number of triangles in the graph divided by the number of triplets in the graph.
Note that this is also known as transitivity and is different to the average clustering coefficient.
- Parameters:
g (Raphtory graph) – a Raphtory graph, treated as undirected
- Returns:
the global clustering coefficient of the graph
- Return type:
See also
[Triplet Count](triplet_count)
- raphtory.algorithms.global_reciprocity(g)#
Reciprocity - measure of the symmetry of relationships in a graph, the global reciprocity of the entire graph. This calculates the number of reciprocal connections (edges that go in both directions) in a graph and normalizes it by the total number of directed edges.
- Parameters:
g (Raphtory graph) – a directed Raphtory graph
- Returns:
reciprocity of the graph between 0 and 1.
- Return type:
- raphtory.algorithms.global_temporal_three_node_motif(g, delta)#
Computes the number of three edge, up-to-three node delta-temporal motifs in the graph, using the algorithm of Paranjape et al, Motifs in Temporal Networks (2017). We point the reader to this reference for more information on the algorithm and background, but provide a short summary below.
Motifs included:
Stars
There are three classes (in the order they are outputted) of star motif on three nodes based on the switching behaviour of the edges between the two leaf nodes.
PRE: Stars of the form i<->j, i<->j, i<->k (ie two interactions with leaf j followed by one with leaf k)
MID: Stars of the form i<->j, i<->k, i<->j (ie switching interactions from leaf j to leaf k, back to j again)
POST: Stars of the form i<->j, i<->k, i<->k (ie one interaction with leaf j followed by two with leaf k)
Within each of these classes is 8 motifs depending on the direction of the first to the last edge – incoming “I” or outgoing “O”. These are enumerated in the order III, IIO, IOI, IOO, OII, OIO, OOI, OOO (like binary with “I”-0 and “O”-1).
Two node motifs:
Also included are two node motifs, of which there are 8 when counted from the perspective of each vertex. These are characterised by the direction of each edge, enumerated in the above order. Note that for the global graph counts, each motif is counted in both directions (a single III motif for one vertex is an OOO motif for the other vertex).
Triangles:
There are 8 triangle motifs:
i –> j, k –> j, i –> k
i –> j, k –> i, j –> k
i –> j, j –> k, i –> k
i –> j, i –> k, j –> k
i –> j, k –> j, k –> i
i –> j, k –> i, k –> j
i –> j, j –> k, k –> i
i –> j, i –> k, k –> j
- Parameters:
g (raphtory graph) – A directed raphtory graph
delta (int) –
motif. NB if time for edges was given as a UNIX epoch, this should be given in seconds, otherwise milliseconds should be used (if edge times were given as string)
- Returns:
A 40 dimensional array with the counts of each motif, given in the same order as described above. Note that the two-node motif counts are symmetrical so it may be more useful just to consider the first four elements.
- Return type:
Notes
This is achieved by calling the local motif counting algorithm, summing the resulting arrays and dealing with overcounted motifs: the triangles (by dividing each motif count by three) and two-node motifs (dividing by two).
- raphtory.algorithms.hits(g, iter_count=Ellipsis, threads=Ellipsis)#
HITS (Hubs and Authority) Algorithm: AuthScore of a vertex (A) = Sum of HubScore of all vertices pointing at vertex (A) from previous iteration /
Sum of HubScore of all vertices in the current iteration
- HubScore of a vertex (A) = Sum of AuthScore of all vertices pointing away from vertex (A) from previous iteration /
Sum of AuthScore of all vertices in the current iteration
Returns
An AlgorithmResult object containing the mapping from vertex ID to the hub and authority score of the vertex
- raphtory.algorithms.local_clustering_coefficient(g, v)#
Local clustering coefficient - measures the degree to which nodes in a graph tend to cluster together.
The proportion of pairs of neighbours of a node who are themselves connected.
- raphtory.algorithms.local_temporal_three_node_motifs(g, delta)#
Computes the number of each type of motif that each node participates in. See global_temporal_three_node_motifs for a summary of the motifs involved.
- Parameters:
g (raphtory graph) – A directed raphtory graph
delta (int) –
motif. NB if time for edges was given as a UNIX epoch, this should be given in seconds, otherwise milliseconds should be used (if edge times were given as string)
- Returns:
An AlgorithmResult with node ids as keys and a 40d array of motif counts (in the same order as the global motif counts) with the number of each
- Return type:
AlgorithmResult
motif that node participates in.
Notes
For this local count, a node is counted as participating in a motif in the following way. For star motifs, only the centre node counts
the motif. For two node motifs, both constituent nodes count the motif. For triangles, all three constituent nodes count the motif.
- raphtory.algorithms.local_triangle_count(g, v)#
Local triangle count - calculates the number of triangles (a cycle of length 3) a vertex participates in.
This function returns the number of pairs of neighbours of a given node which are themselves connected.
- raphtory.algorithms.max_in_degree(g)#
The maximum in degree of any vertex in the graph.
- Parameters:
g (Raphtory graph) – a directed Raphtory graph
- Returns:
value of the largest indegree
- Return type:
- raphtory.algorithms.max_out_degree(g)#
The maximum out degree of any vertex in the graph.
- Parameters:
g (Raphtory graph) – a directed Raphtory graph
- Returns:
value of the largest outdegree
- Return type:
- raphtory.algorithms.min_in_degree(g)#
The minimum in degree of any vertex in the graph.
- Parameters:
g (Raphtory graph) – a directed Raphtory graph
- Returns:
value of the smallest indegree
- Return type:
- raphtory.algorithms.min_out_degree(g)#
The minimum out degree of any vertex in the graph.
- Parameters:
g (Raphtory graph) – a directed Raphtory graph
- Returns:
value of the smallest outdegree
- Return type:
- raphtory.algorithms.pagerank(g, iter_count=Ellipsis, max_diff=Ellipsis)#
Pagerank – pagerank centrality value of the vertices in a graph
This function calculates the Pagerank value of each vertex in a graph. See https://en.wikipedia.org/wiki/PageRank for more information on PageRank centrality. A default damping factor of 0.85 is used. This is an iterative algorithm which terminates if the sum of the absolute difference in pagerank values between iterations is less than the max diff value given.
- Parameters:
g (Raphtory graph) – Raphtory graph
iter_count (int) – Maximum number of iterations to run. Note that this will terminate early if convergence is reached.
max_diff (float) – Optional parameter providing an alternative stopping condition. The algorithm will terminate if the sum of the absolute difference in pagerank values between iterations
is less than the max diff value given.
- Returns:
AlgorithmResult with string keys and float values mapping vertex names to their pagerank value.
- Return type:
AlgorithmResult
- raphtory.algorithms.temporally_reachable_nodes(g, max_hops, start_time, seed_nodes, stop_nodes=Ellipsis)#
Temporally reachable nodes – the nodes that are reachable by a time respecting path followed out from a set of seed nodes at a starting time.
This function starts at a set of seed nodes and follows all time respecting paths until either a) a maximum number of hops is reached, b) one of a set of stop nodes is reached, or c) no further time respecting edges exist. A time respecting path is a sequence of nodes v_1, v_2, … , v_k such that there exists a sequence of edges (v_i, v_i+1, t_i) with t_i < t_i+1 for i = 1, … , k - 1.
- Parameters:
g (Raphtory graph) – directed Raphtory graph
max_hops (int) – maximum number of hops to propagate out
start_time (int) – time at which to start the path (such that t_1 > start_time for any path starting from these seed nodes)
seed_nodes (list(str) or list(int)) – list of vertex names or ids which should be the starting nodes
stop_nodes (list(str) or list(int)) – nodes at which a path shouldn’t go any further
- Returns:
AlgorithmResult with string keys and float values mapping vertex names to their pagerank value.
- Return type:
AlgorithmResult
- raphtory.algorithms.triplet_count(g)#
Computes the number of connected triplets within a graph
A connected triplet (also known as a wedge, 2-hop path) is a pair of edges with one node in common. For example, the triangle made up of edges A-B, B-C, C-A is formed of three connected triplets.
- Parameters:
g (Raphtory graph) – a Raphtory graph, treated as undirected
- Returns:
the number of triplets in the graph
- Return type:
- raphtory.algorithms.weakly_connected_components(g, iter_count=Ellipsis)#
Weakly connected components – partitions the graph into node sets which are mutually reachable by an undirected path
This function assigns a component id to each vertex such that vertices with the same component id are mutually reachable by an undirected path.
- Parameters:
g (Raphtory graph) – Raphtory graph
iter_count (int) – Maximum number of iterations to run. Note that this will terminate early if the labels converge prior to the number of iterations being reached.
- Returns:
AlgorithmResult object with string keys and integer values mapping vertex names to their component ids.
- Return type:
AlgorithmResult
Visualisation#
Generate a visualisation using matplotlib or pyvis from Raphtory graphs.
Functions:
|
Returns a Network X graph visualiation from a Raphtory graph. |
|
Returns a dynamic visualisation in static HTML format from a Raphtory graph. |
- raphtory.vis.to_networkx(graph, k=None, iterations=50, node_size=300, node_color='#1f78b4', edge_color='k', arrows=None, arrow_style='-|>')#
Returns a Network X graph visualiation from a Raphtory graph.
- raphtory.vis.to_pyvis(graph, edge_color='#000000', shape=None, node_image=None, edge_weight=None, edge_label=None, colour_nodes_by_type=False, type_property='type', notebook=True, **kwargs)#
Returns a dynamic visualisation in static HTML format from a Raphtory graph.
Null Models#
Generate randomised reference models for a temporal graph edgelist
Functions:
|
Returns a DataFrame with the time column shuffled. |
|
Returns an edgelist with a given column shuffled. |
|
Returns an edgelist with given columns shuffled. |
- raphtory.nullmodels.permuted_timestamps_model(graph_df: DataFrame, time_col: int | None = None, time_name: str | None = None, inplace=False, sorted=False)#
Returns a DataFrame with the time column shuffled.
- Parameters:
graph_df (pd.DataFrame) – The input DataFrame representing the graph.
time_col (int, optional) – The column number of the time column to shuffle. Default is None.
time_name (str, optional) – The column name of the time column to shuffle. Default is None.
inplace (bool, optional) – If True, shuffles the time column in-place. Otherwise, creates a copy of the DataFrame. Default is False.
sorted (bool, optional) – If True, sorts the DataFrame by the shuffled time column. Default is False.
- Returns:
The shuffled DataFrame with the time column, or None if inplace=True.
- Return type:
pd.DataFrame or None
- raphtory.nullmodels.shuffle_column(graph_df: DataFrame, col_number=None, col_name=None, inplace=False)#
Returns an edgelist with a given column shuffled. Exactly one of col_number or col_name should be specified.
- Parameters:
graph_df (pd.DataFrame) – The input DataFrame representing the timestamped edgelist.
col_number (int, optional) – The column number to shuffle. Default is None.
col_name (str, optional) – The column name to shuffle. Default is None.
inplace (bool, optional) – If True, shuffles the column in-place. Otherwise, creates a copy of the DataFrame. Default is False.
- Returns:
The shuffled DataFrame with the specified column.
- Return type:
pd.DataFrame
- Raises:
AssertionError – If neither col_number nor col_name is provided.
AssertionError – If both col_number and col_name are provided.
- raphtory.nullmodels.shuffle_multiple_columns(graph_df: DataFrame, col_numbers: list | None = None, col_names: list | None = None, inplace=False)#
Returns an edgelist with given columns shuffled. Exactly one of col_numbers or col_names should be specified.
- Parameters:
graph_df (pd.DataFrame) – The input DataFrame representing the graph.
col_numbers (list, optional) – The list of column numbers to shuffle. Default is None.
col_names (list, optional) – The list of column names to shuffle. Default is None.
inplace (bool, optional) – If True, shuffles the columns in-place. Otherwise, creates a copy of the DataFrame. Default is False.
- Returns:
The shuffled DataFrame with the specified columns.
- Return type:
pd.DataFrame
- Raises:
AssertionError – If neither col_numbers nor col_names are provided.
AssertionError – If both col_numbers and col_names are provided.
Graph Generation#
Generate Raphtory graphs from attachment models
Functions:
|
Generates a graph using the preferential attachment model. |
|
Generates a graph using the random attachment model |
- raphtory.graph_gen.ba_preferential_attachment(g, vertices_to_add, edges_per_step)#
Generates a graph using the preferential attachment model.
Given a graph this function will add a user defined number of vertices, each with a user defined number of edges. This is an iterative algorithm where at each step a vertex is added and its neighbours are chosen from the pool of nodes already within the network. For this model the neighbours are chosen proportionally based upon their degree, favouring nodes with higher degree (more connections). This sampling is conducted without replacement.
Note: If the provided graph doesnt have enough nodes/edges for the initial sample, the min number of both will be added before generation begins.
- Parameters:
g – The graph you wish to add vertices and edges to
vertices_to_add – The amount of vertices you wish to add to the graph (steps)
edges_per_step – The amount of edges a joining vertex should add to the graph
Returns:
None
- raphtory.graph_gen.random_attachment(g, vertices_to_add, edges_per_step)#
Generates a graph using the random attachment model
This function is a graph generation model based upon: Callaway, Duncan S., et al. “Are randomly grown graphs really random?.” Physical Review E 64.4 (2001): 041902.
- Parameters:
g – The graph you wish to add vertices and edges to
vertices_to_add – The amount of vertices you wish to add to the graph (steps)
edges_per_step – The amount of edges a joining vertex should add to the graph
- Returns:
None