![]() |
STAG Python
1.2.1
Spectral Toolkit of Algorithms for Graphs
|
Classes | |
class | AdjacencyListLocalGraph |
A local graph backed by an adjacency list file on disk. More... | |
class | Edge |
An object representing a weighted edge in a graph. More... | |
class | Graph |
The core object used to represent graphs for use with the library. More... | |
class | LocalGraph |
An abstract class which defines methods for exploring the local neighborhood of vertices in a graph. More... | |
Functions | |
Graph | cycle_graph (n) |
Construct a cycle graph on n vertices. | |
Graph | complete_graph (n) |
Construct a complete graph on n vertices. | |
Graph | barbell_graph (n) |
Construct a barbell graph. | |
Graph | star_graph (n) |
Construct a star graph. | |
def | from_networkx (networkx.Graph netx_graph, str edge_weight_attribute="weight") |
Given a networkx graph, convert it to a stag.graph.Graph object. | |
Graph stag.graph.cycle_graph | ( | n | ) |
Construct a cycle graph on n vertices.
n | the number of vertices in the constructed graph |
Graph stag.graph.complete_graph | ( | n | ) |
Construct a complete graph on n vertices.
n | the number of vertices in the constructed graph |
Graph stag.graph.barbell_graph | ( | n | ) |
Construct a barbell graph.
The barbell graph consists of 2 cliques on n vertices, connected by a single edge.
n | the number of vertices in each of the two cliques. The returned graph will have \(2n\) vertices. |
Graph stag.graph.star_graph | ( | n | ) |
Construct a star graph.
The star graph consists of one central vertex connected by an edge to n-1 outer vertices.
n | the number of vertices in the constructed graph |
def stag.graph.from_networkx | ( | networkx.Graph | netx_graph, |
str | edge_weight_attribute = "weight" |
||
) |
Given a networkx graph, convert it to a stag.graph.Graph object.
Unless otherwise specified, this method will use the 'weight' attribute on the networkx edges to assign the weight of the edges. If no such attribute is present, the edges will be added with weight \(1\).
netx_graph | The networkx graph object to be converted. |
edge_weight_attribute | (default 'weight') the edge attribute to be used to generate the weights |