snark-tool 0.4.0

snark-tool library contains structures and algorithm for (mainly) cubic graph analysis
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
use crate::graph::undirected::simple_graph::graph::SimpleGraph;
use crate::graph::undirected::UndirectedGraph;
use crate::procedure::basic_procedures::chrom_props::config::{
    ChromaticPropertiesToCompute, ChromaticPropsProcedureConfig, ParallelizationType, ACRITICAL,
    COCRITICAL, COSTABLE, CRITICAL, CYCLIC_EDGE_CONNECTIVITY, EDGE_RESISTIBILITIES,
    EDGE_RESISTIBILITY_INDEX, EDGE_SUBCRITICAL, GIRTH, GRAPH_INDEX, ODDNESS, RESISTANCE, STABLE,
    VERTEX_RESISTIBILITIES, VERTEX_RESISTIBILITY_INDEX, VERTEX_SUBCRITICAL,
};
use crate::procedure::basic_procedures::colour::ColouriserType;
use crate::procedure::helpers::serialize_helper;
use crate::procedure::procedure;
use crate::procedure::procedure::{GraphProperties, Procedure};
use crate::procedure::procedure_builder::{ConfigMap, ProcedureBuilder};
use crate::service::chromatic_properties::critical_prop::CriticalPropertiesSolver;
use crate::service::chromatic_properties::critical_prop_parallel::CriticalPropertiesParallelSolver;
use crate::service::chromatic_properties::error::ChromaticPropertiesError;
use crate::service::chromatic_properties::resistance::Resistance;
use crate::service::chromatic_properties::resistibility::Resistibility;
use crate::service::chromatic_properties::stable_and_critical_prop::StableAndCriticalPropertiesSolver;
use crate::service::chromatic_properties::stable_and_critical_prop_parallel::StableAndCriticalPropertiesParallelSolver;
use crate::service::chromatic_properties::CriticalProperties;
use crate::service::colour::colouriser::Colouriser;
use crate::service::colour::recursive::dfs_improved::DFSColourizer;
use crate::service::colour::sat::sat::SATColourizer;
use crate::service::property::cyclic_connectivity::cyclic_edge_connectivity;
use crate::service::property::girth::girth;
use crate::service::property::oddness::Oddness;
use std::borrow::Borrow;
use std::collections::HashMap;
use std::sync::mpsc;
use std::{marker, result, thread};
use crate::service::colour::cvd::cvd_sat::CvdSatColourizer;
use crate::service::colour::cvd::cvd_dfs::CvdDfsColourizer;

pub type Result<T> = result::Result<T, ChromaticPropertiesError>;

struct ChromaticPropsProcedure<G> {
    config: ChromaticPropsProcedureConfig,
    _ph: marker::PhantomData<G>,
}

pub struct ChromaticPropsProcedureBuilder {}

impl<G: UndirectedGraph + Clone> Procedure<G> for ChromaticPropsProcedure<G> {
    fn run(&self, graphs: &mut Vec<(G, GraphProperties)>) -> procedure::Result<()> {
        println!("running chromatic properties procedure");
        self.chromatic_properties(graphs)?;
        Ok(())
    }
}

impl<G: UndirectedGraph + Clone> ChromaticPropsProcedure<G> {
    fn chromatic_properties(&self, graphs: &mut Vec<(G, GraphProperties)>) -> Result<()> {
        let colouriser_type = self.config.colouriser_type();
        let parallelization = self.config.parallelization();
        match parallelization {
            ParallelizationType::BatchBased => {
                self.chromatic_properties_batch_parallel(graphs, colouriser_type)?;
            }
            ParallelizationType::GraphBased => {
                self.chromatic_properties_graph_parallel(graphs, colouriser_type)?;
            }
            ParallelizationType::None => {
                self.chromatic_properties_sequential(graphs, colouriser_type)?;
            }
        }
        Ok(())
    }

    fn chromatic_properties_batch_parallel(
        &self,
        graphs: &mut Vec<(G, GraphProperties)>,
        colouriser_type: &ColouriserType,
    ) -> Result<()> {
        let mut threads = HashMap::new();
        let mut index = 0;
        let (tx, rx) = mpsc::channel();

        let cpus_count = self.config.max_threads;
        let to_compute = &self.config.properties_to_compute;

        // init first threads
        let mut graphs_iter = graphs.iter();
        let mut next_graph = graphs_iter.next();
        while next_graph.is_some() {
            let graph = next_graph.unwrap();
            // if graph is bigger could cause performance issues
            let graph_local = SimpleGraph::from_graph(&graph.0);
            let tx_cloned = mpsc::Sender::clone(&tx);
            let handle = Self::spawn_thread_for_graph(
                graph_local,
                index,
                (*colouriser_type).clone(),
                (*to_compute).clone(),
                tx_cloned,
            );
            threads.insert(index, handle);
            index += 1;
            if index >= cpus_count {
                break;
            }
            next_graph = graphs_iter.next();
        }
        let mut results = Vec::with_capacity(graphs.len());

        // receive results and create new threads while next graphs exists
        for received in &rx {
            let received_result = received.borrow().as_ref();
            let index_value = received_result.unwrap().get(GRAPH_INDEX).unwrap();
            let received_index: usize = serde_json::from_value(index_value.clone())?;

            // end/join thread which sent received results
            let thread_opt = threads.remove(&received_index);
            if thread_opt.is_some() {
                let _result = thread_opt.unwrap().join();
            }
            results.push(received);

            next_graph = graphs_iter.next();
            if next_graph.is_some() {
                let graph = next_graph.unwrap();
                let graph_local = SimpleGraph::from_graph(&graph.0);
                let tx_cloned = mpsc::Sender::clone(&tx);
                let handle = Self::spawn_thread_for_graph(
                    graph_local,
                    index,
                    colouriser_type.clone(),
                    (*to_compute).clone(),
                    tx_cloned,
                );
                threads.insert(index, handle);
                index += 1;
            } else {
                break;
            }
        }

        drop(tx);

        // receive remaining results
        for received in rx {
            results.push(received);
        }
        for result in results {
            self.handle_parallel_result(graphs, result)?;
        }
        // end/join remaining threads
        for thread in threads {
            thread.1.join().unwrap();
        }
        Ok(())
    }

    fn chromatic_properties_graph_parallel(
        &self,
        graphs: &mut Vec<(G, GraphProperties)>,
        colouriser_type: &ColouriserType,
    ) -> Result<()> {
        let mut index = 0;
        for graph in graphs {
            let properties = Self::compute_properties_by_colouriser_parallel(
                &graph.0,
                colouriser_type,
                index,
                &self.config.properties_to_compute,
                self.config.max_threads,
            )?;
            self.write_properties(graph, properties)?;
            index += 1;
        }
        Ok(())
    }

    fn chromatic_properties_sequential(
        &self,
        graphs: &mut Vec<(G, GraphProperties)>,
        colouriser_type: &ColouriserType,
    ) -> Result<()> {
        let mut index = 0;
        for graph in graphs {
            let properties = Self::compute_properties_by_colouriser(
                &graph.0,
                colouriser_type,
                index,
                &self.config.properties_to_compute,
            )?;
            self.write_properties(graph, properties)?;
            index += 1;
        }
        Ok(())
    }

    fn handle_parallel_result(
        &self,
        graphs: &mut Vec<(G, GraphProperties)>,
        result: Result<GraphProperties>,
    ) -> Result<()> {
        let result_props = result?;
        let graph_index_opt_value = result_props.get(GRAPH_INDEX);
        if graph_index_opt_value.is_some() {
            let graph_index_value = graph_index_opt_value.unwrap();
            let graph_index: usize = serde_json::from_value(graph_index_value.clone())?;
            graphs[graph_index].1.extend(result_props);
            return Ok(());
        }
        Err(ChromaticPropertiesError::new(
            "graph index is missing in parallel result",
        ))
    }

    fn spawn_thread_for_graph(
        graph: SimpleGraph,
        index: usize,
        colouriser_type: ColouriserType,
        properties_to_compute: ChromaticPropertiesToCompute,
        sender: mpsc::Sender<Result<GraphProperties>>,
    ) -> thread::JoinHandle<()> {
        let handle = thread::spawn(move || {
            let result = Self::compute_properties_by_colouriser(
                &graph,
                &colouriser_type,
                index,
                &properties_to_compute,
            );
            let result = sender.send(result);
            if result.is_err() {
                // handle otherwise?
                panic!(
                    "error while sending message between threads: {}",
                    result.err().unwrap()
                );
            }
        });
        handle
    }

    fn compute_properties_by_colouriser<Gr: UndirectedGraph + Clone>(
        graph: &Gr,
        colouriser_type: &ColouriserType,
        graph_index: usize,
        properties_to_compute: &ChromaticPropertiesToCompute,
    ) -> Result<GraphProperties> {
        // to do - change colouriser type according to graph size ...
        return match colouriser_type {
            ColouriserType::Sat => {
                Self::compute_properties(
                    graph,
                    SATColourizer::new(),
                    graph_index,
                    &properties_to_compute,
                )
            }
            ColouriserType::Dfs => {
                Self::compute_properties(
                    graph,
                    DFSColourizer::new(),
                    graph_index,
                    &properties_to_compute,
                )
            }
            ColouriserType::CvdSat => {
                Self::compute_properties(
                    graph,
                    CvdSatColourizer::new(),
                    graph_index,
                    &properties_to_compute,
                )
            }
            ColouriserType::CvdDfs => {
                Self::compute_properties(
                    graph,
                    CvdDfsColourizer::new(),
                    graph_index,
                    &properties_to_compute,
                )
            }
            _ => {
                Err(ChromaticPropertiesError {
                    message: format!("unknown colourizer to compute chromatic properties"),
                })
            }
        }
    }

    fn compute_properties_by_colouriser_parallel<Gr: UndirectedGraph + Clone>(
        graph: &Gr,
        colouriser_type: &ColouriserType,
        graph_index: usize,
        properties_to_compute: &ChromaticPropertiesToCompute,
        max_threads: usize,
    ) -> Result<GraphProperties> {
        // to do - change colouriser type according to graph size ...
        match colouriser_type {
            ColouriserType::Sat => {
                return Self::compute_properties_parallel(
                    graph,
                    SATColourizer::new(),
                    graph_index,
                    &properties_to_compute,
                    max_threads,
                );
            }
            ColouriserType::Dfs => {
                return Self::compute_properties_parallel(
                    graph,
                    DFSColourizer::new(),
                    graph_index,
                    &properties_to_compute,
                    max_threads,
                );
            }
            _ => {
                return Err(ChromaticPropertiesError {
                    message: format!("unknown colourizer to compute chromatic properties"),
                });
            }
        }
    }

    fn compute_properties<Gr: UndirectedGraph + Clone, C: Colouriser>(
        graph: &Gr,
        colouriser: C,
        graph_index: usize,
        properties_to_compute: &ChromaticPropertiesToCompute,
    ) -> Result<GraphProperties> {
        let to_compute = properties_to_compute;
        let mut properties = GraphProperties::new();
        properties.insert(GRAPH_INDEX.to_string(), serde_json::to_value(graph_index)?);

        if to_compute.stable || to_compute.costable {
            Self::critical_and_stable_properties(
                graph,
                &colouriser,
                properties_to_compute,
                &mut properties,
            )?;
        } else if to_compute.critical
            || to_compute.cocritical
            || to_compute.vertex_subcritical
            || to_compute.edge_subcritical
        {
            // compute critical props
            Self::critical_properties(graph, &colouriser, properties_to_compute, &mut properties)?;
        }

        if to_compute.resistance {
            // compute resistence and add result to properties
            Self::resistance(graph, &colouriser, &mut properties)?;
        }
        if to_compute.vertex_resistibility {
            // compute vertex resistibility and add result to properties
            Self::vertex_resistibility(graph, &colouriser, &mut properties)?;
        }
        if to_compute.edge_resistibility {
            // compute edge resistibility and add result to properties
            Self::edge_resistibility(graph, &colouriser, &mut properties)?;
        }
        if to_compute.girth {
            // compute girth and add result to properties
            let girth = girth(graph);
            properties.insert(GIRTH.to_string(), serde_json::to_value(girth)?);
        }
        if to_compute.cyclic_connectivity {
            // compute cyclic connectivity and add result to properties
            let cyclic_edge_connectivity = cyclic_edge_connectivity(graph);
            properties.insert(
                CYCLIC_EDGE_CONNECTIVITY.to_string(),
                serde_json::to_value(cyclic_edge_connectivity)?,
            );
        }
        if to_compute.oddness {
            // compute cyclic connectivity and add result to properties
            let oddness = Oddness::of_graph(graph);
            properties.insert(ODDNESS.to_string(), serde_json::to_value(oddness)?);
        }

        Ok(properties)
    }

    fn compute_properties_parallel<Gr: UndirectedGraph + Clone, C: Colouriser + Send + 'static>(
        graph: &Gr,
        colouriser: C,
        graph_index: usize,
        properties_to_compute: &ChromaticPropertiesToCompute,
        max_threads: usize,
    ) -> Result<GraphProperties> {
        let to_compute = properties_to_compute;
        let mut properties = GraphProperties::new();
        properties.insert(GRAPH_INDEX.to_string(), serde_json::to_value(graph_index)?);

        if to_compute.stable || to_compute.costable {
            Self::critical_and_stable_properties_parallel(
                graph,
                &colouriser,
                properties_to_compute,
                &mut properties,
                max_threads,
            )?;
        } else if to_compute.critical
            || to_compute.cocritical
            || to_compute.vertex_subcritical
            || to_compute.edge_subcritical
        {
            // compute critical props
            Self::critical_properties_parallel(
                graph,
                &colouriser,
                properties_to_compute,
                &mut properties,
                max_threads,
            )?;
        }

        if to_compute.resistance {
            // compute resistence and add result to properties
            Self::resistance(graph, &colouriser, &mut properties)?;
        }
        if to_compute.vertex_resistibility {
            // compute vertex resistibility and add result to properties
            Self::vertex_resistibility(graph, &colouriser, &mut properties)?;
        }
        if to_compute.edge_resistibility {
            // compute edge resistibility and add result to properties
            Self::edge_resistibility(graph, &colouriser, &mut properties)?;
        }
        if to_compute.girth {
            // compute girth and add result to properties
            let girth = girth(graph);
            properties.insert(GIRTH.to_string(), serde_json::to_value(girth)?);
        }
        if to_compute.cyclic_connectivity {
            // compute cyclic connectivity and add result to properties
            let cyclic_edge_connectivity = cyclic_edge_connectivity(graph);
            properties.insert(
                CYCLIC_EDGE_CONNECTIVITY.to_string(),
                serde_json::to_value(cyclic_edge_connectivity)?,
            );
        }
        if to_compute.oddness {
            // compute cyclic connectivity and add result to properties
            let oddness = Oddness::of_graph(graph);
            properties.insert(ODDNESS.to_string(), serde_json::to_value(oddness)?);
        }

        Ok(properties)
    }

    fn critical_and_stable_properties<Gr: UndirectedGraph + Clone, C: Colouriser>(
        graph: &Gr,
        _colouriser: &C,
        properties_to_compute: &ChromaticPropertiesToCompute,
        properties_computed: &mut GraphProperties,
    ) -> Result<()> {
        let mut props =
            StableAndCriticalPropertiesSolver::of_graph_with_colourizer(graph, C::new());
        Self::add_critical_properties(properties_to_compute, properties_computed, &mut props)?;
        if properties_to_compute.stable {
            properties_computed.insert(
                STABLE.to_string(),
                serde_json::Value::Bool(props.is_stable()),
            );
        }
        if properties_to_compute.costable {
            properties_computed.insert(
                COSTABLE.to_string(),
                serde_json::Value::Bool(props.is_costable()),
            );
        }
        Ok(())
    }

    fn critical_and_stable_properties_parallel<
        Gr: UndirectedGraph + Clone,
        C: Colouriser + Send + 'static,
    >(
        graph: &Gr,
        _colouriser: &C,
        properties_to_compute: &ChromaticPropertiesToCompute,
        properties_computed: &mut GraphProperties,
        max_threads: usize,
    ) -> Result<()> {
        let mut props =
            StableAndCriticalPropertiesParallelSolver::of_graph_with_colourizer(graph, C::new());
        props.set_cpus_count(max_threads);
        Self::add_critical_properties(properties_to_compute, properties_computed, &mut props)?;
        if properties_to_compute.stable {
            properties_computed.insert(
                STABLE.to_string(),
                serde_json::Value::Bool(props.is_stable()),
            );
        }
        if properties_to_compute.costable {
            properties_computed.insert(
                COSTABLE.to_string(),
                serde_json::Value::Bool(props.is_costable()),
            );
        }
        Ok(())
    }

    fn critical_properties<Gr: UndirectedGraph + Clone, C: Colouriser>(
        graph: &Gr,
        _colouriser: &C,
        properties_to_compute: &ChromaticPropertiesToCompute,
        properties_computed: &mut GraphProperties,
    ) -> Result<()> {
        let mut props = CriticalPropertiesSolver::of_graph_with_colourizer(graph, C::new());
        Self::add_critical_properties(properties_to_compute, properties_computed, &mut props)
    }

    fn critical_properties_parallel<Gr: UndirectedGraph + Clone, C: Colouriser + Send + 'static>(
        graph: &Gr,
        _colouriser: &C,
        properties_to_compute: &ChromaticPropertiesToCompute,
        properties_computed: &mut GraphProperties,
        max_threads: usize,
    ) -> Result<()> {
        let mut props = CriticalPropertiesParallelSolver::of_graph_with_colourizer(graph, C::new());
        props.set_cpus_count(max_threads);
        Self::add_critical_properties(properties_to_compute, properties_computed, &mut props)
    }

    fn add_critical_properties(
        properties_to_compute: &ChromaticPropertiesToCompute,
        properties_computed: &mut GraphProperties,
        props: &mut impl CriticalProperties,
    ) -> Result<()> {
        if properties_to_compute.critical {
            properties_computed.insert(
                CRITICAL.to_string(),
                serde_json::Value::Bool(props.is_critical()),
            );
        }
        if properties_to_compute.cocritical {
            properties_computed.insert(
                COCRITICAL.to_string(),
                serde_json::Value::Bool(props.is_cocritical()),
            );
        }
        if properties_to_compute.vertex_subcritical {
            properties_computed.insert(
                VERTEX_SUBCRITICAL.to_string(),
                serde_json::Value::Bool(props.is_vertex_subcritical()),
            );
        }
        if properties_to_compute.edge_subcritical {
            properties_computed.insert(
                EDGE_SUBCRITICAL.to_string(),
                serde_json::Value::Bool(props.is_edge_subcritical()),
            );
        }
        if properties_to_compute.acritical {
            properties_computed.insert(
                ACRITICAL.to_string(),
                serde_json::Value::Bool(props.is_acritical()),
            );
        }
        Ok(())
    }

    fn resistance<Gr: UndirectedGraph + Clone, C: Colouriser>(
        graph: &Gr,
        _colouriser: &C,
        properties_computed: &mut GraphProperties,
    ) -> Result<()> {
        let resistance = Resistance::new_with_colouriser(C::new());
        let resistance = resistance.vertex_resistance(graph);
        if resistance.is_some() {
            properties_computed.insert(
                RESISTANCE.to_string(),
                serde_json::to_value(resistance.unwrap())?,
            );
        } else {
            properties_computed.insert(
                RESISTANCE.to_string(),
                serde_json::Value::String("None".to_string()),
            );
        }
        Ok(())
    }

    fn edge_resistibility<Gr: UndirectedGraph + Clone, C: Colouriser>(
        graph: &Gr,
        _colouriser: &C,
        properties_computed: &mut GraphProperties,
    ) -> Result<()> {
        let mut resistibility = Resistibility::of_graph_with_colouriser(graph, C::new());
        let edge_resistibilities = resistibility.edges_resistibility();
        let edge_resistibilities_json = serialize_helper::map_to_json_value(edge_resistibilities)?;
        properties_computed.insert(EDGE_RESISTIBILITIES.to_string(), edge_resistibilities_json);

        let index_of_edge_resistibility = resistibility.edge_resistibility_index();
        properties_computed.insert(
            EDGE_RESISTIBILITY_INDEX.to_string(),
            serde_json::to_value(index_of_edge_resistibility)?,
        );

        Ok(())
    }

    fn vertex_resistibility<Gr: UndirectedGraph + Clone, C: Colouriser>(
        graph: &Gr,
        _colouriser: &C,
        properties_computed: &mut GraphProperties,
    ) -> Result<()> {
        let mut resistibility = Resistibility::of_graph_with_colouriser(graph, C::new());
        let vertices_resistibility = resistibility.vertices_resistibility();
        // let vertex_resistibilities_json =
        //     serialize_helper::vec_to_json_value(vertices_resistibility)?;
        let vertex_resistibilities_json = serde_json::to_value(vertices_resistibility)?;
        properties_computed.insert(
            VERTEX_RESISTIBILITIES.to_string(),
            vertex_resistibilities_json,
        );

        let vertex_resistibility_index = resistibility.vertex_resistibility_index();
        properties_computed.insert(
            VERTEX_RESISTIBILITY_INDEX.to_string(),
            serde_json::to_value(vertex_resistibility_index)?,
        );

        Ok(())
    }

    fn write_properties(
        &self,
        graph: &mut (G, GraphProperties),
        props: GraphProperties,
    ) -> Result<()> {
        graph.1.extend(props);
        Ok(())
    }
}

impl<G: UndirectedGraph + Clone + 'static> ProcedureBuilder<G> for ChromaticPropsProcedureBuilder {
    fn build_from_map(&self, config: ConfigMap) -> procedure::Result<Box<dyn Procedure<G>>> {
        let proc_config = ChromaticPropsProcedureConfig::from_proc_config(&config)?;
        Ok(Box::new(ChromaticPropsProcedure {
            config: proc_config,
            _ph: marker::PhantomData,
        }))
    }
}

impl ChromaticPropsProcedureBuilder {
    pub fn build<G: UndirectedGraph + Clone + 'static>(
        config: ChromaticPropsProcedureConfig,
    ) -> Box<dyn Procedure<G>> {
        Box::new(ChromaticPropsProcedure {
            config,
            _ph: marker::PhantomData,
        })
    }
}