Skip to main content

GraphTensorExt

Trait GraphTensorExt 

Source
pub trait GraphTensorExt<T, E> {
    // Required methods
    fn to_tensor_representation(
        &self,
    ) -> Result<(DenseTensor, GraphAdjacencyMatrix), TensorError>
       where T: AsRef<[f64]> + Clone,
             E: Clone;
    fn adjacency_matrix(&self) -> Result<GraphAdjacencyMatrix, TensorError>;
    fn node_features(
        &self,
        num_features: usize,
    ) -> Result<DenseTensor, TensorError>
       where T: AsRef<[f64]> + Clone;
    fn feature_extractor(&self) -> GraphFeatureExtractor<'_, T, E>;
}
Expand description

Extension trait for Graph to add tensor conversion methods

Required Methods§

Source

fn to_tensor_representation( &self, ) -> Result<(DenseTensor, GraphAdjacencyMatrix), TensorError>
where T: AsRef<[f64]> + Clone, E: Clone,

Convert graph to tensor representation

Source

fn adjacency_matrix(&self) -> Result<GraphAdjacencyMatrix, TensorError>

Get adjacency matrix as sparse tensor

Source

fn node_features(&self, num_features: usize) -> Result<DenseTensor, TensorError>
where T: AsRef<[f64]> + Clone,

Extract node features as tensor

Source

fn feature_extractor(&self) -> GraphFeatureExtractor<'_, T, E>

Create feature extractor

Implementors§

Source§

impl<T, E> GraphTensorExt<T, E> for Graph<T, E>
where T: Clone, E: Clone,