EdgeGnW / RustPraxisProjekt2024

A rust graph library utilizing wavelettrees/matrices
0 stars 0 forks source link

Edge_map on transforming undirected GraphModels #38

Closed DerFred3 closed 3 days ago

DerFred3 commented 2 weeks ago

When trying to transform some undirected GraphModel into its equivalent WaveModel the subsequently constructed 'edge_map' from that WaveModel will not contain the 'returning' edges that define an undirected graph.

This happens as a result inside of TryFrom for WaveModel inside of wavemodel.rs:

for edge_index in value.edge_indicies() {
    match value.edge_endpoints(edge_index) {
        Some((a, b)) => {
            let a_label = match value.node_label(a) {
                Some(label) => label.clone(),
                None => return Err(WaveModelError::ConversionError),
            };

            let b_label = match value.node_label(b) {
                Some(label) => label.clone(),
                None => return Err(WaveModelError::ConversionError),
            };

            edge_map.insert((a_label, b_label), edge_index.index());
        }
        None => return Err(WaveModelError::InvalidEdge),
    }
}

The resulting 'edge_map' shows only the edges that were before explicitly given to the undirected GraphModel.

DerFred3 commented 5 days ago

edge_map is to be assumed as directed. On undirected case another look up needs to be make for the 'returning' edge