stgraph.graph.static package

Submodules

stgraph.graph.static.csr module

CPython module for CSR

class stgraph.graph.static.csr.CSR

Bases: pybind11_object

property column_indices_ptr
property eids_ptr
property in_degrees
property node_ids_ptr
property out_degrees
property row_offset_ptr
property weighted_out_degrees
stgraph.graph.static.csr.get_array(arg0: int, arg1: int) List[int]

Get Array

stgraph.graph.static.static_graph module

Represent Static graphs in STGraph.

class stgraph.graph.static.static_graph.StaticGraph(edge_list: list, edge_weights: list, num_nodes: int)[source]

Bases: STGraphBase

Represent Static graphs in STGraph.

This abstract class outlines the interface for defining a static graphs used in STGraph. As of now the static graph is implemented using the Compressed Sparse Row (CSR) format.

Example:

from stgraph.graph import StaticGraph
from stgraph.dataset import HungaryCPDataLoader

hungary = HungaryCPDataLoader()

graph = StaticGraph(
    edge_list = hungary.get_edges(),
    edge_weights = hungary.get_edge_weights(),
    num_nodes = hungary.gdata["num_nodes"]
)
get_ndata(field: any) any[source]

Return the graph metadata.

get_num_edges() int[source]

Return the number of edges in the static graph.

get_num_nodes() int[source]

Return the number of nodes in the static graph.

graph_type() str[source]

Return the graph type.

in_degrees() ndarray[source]

Return the graph inwards node degree array.

out_degrees() ndarray[source]

Return the graph outwards node degree array.

set_ndata(field: str, val: any) None[source]

Set the graph metadata.

weighted_in_degrees() ndarray[source]

weighted_in_degrees.

Module contents

Static Graph respresentation modules provided by STGraph.