1use std::ops::Deref;
9use std::path::Path;
10
11use crate::graph::*;
12use crate::properties;
13
14impl<T: Deref> SwhGraph for T
15where
16 <T as Deref>::Target: SwhGraph,
17{
18 #[inline(always)]
19 fn path(&self) -> &Path {
20 self.deref().path()
21 }
22 #[inline(always)]
23 fn is_transposed(&self) -> bool {
24 self.deref().is_transposed()
25 }
26 #[inline(always)]
27 fn num_nodes(&self) -> usize {
28 self.deref().num_nodes()
29 }
30 #[inline(always)]
31 fn has_node(&self, node_id: NodeId) -> bool {
32 self.deref().has_node(node_id)
33 }
34 #[inline(always)]
35 fn num_arcs(&self) -> u64 {
36 self.deref().num_arcs()
37 }
38 #[inline(always)]
39 fn has_arc(&self, src_node_id: NodeId, dst_node_id: NodeId) -> bool {
40 self.deref().has_arc(src_node_id, dst_node_id)
41 }
42}
43
44impl<T: Deref> SwhForwardGraph for T
45where
46 <T as Deref>::Target: SwhForwardGraph,
47{
48 type Successors<'succ>
49 = <<T as Deref>::Target as SwhForwardGraph>::Successors<'succ>
50 where
51 Self: 'succ;
52
53 #[inline(always)]
54 fn successors(&self, node_id: NodeId) -> Self::Successors<'_> {
55 self.deref().successors(node_id)
56 }
57 #[inline(always)]
58 fn outdegree(&self, node_id: NodeId) -> usize {
59 self.deref().outdegree(node_id)
60 }
61}
62
63impl<T: Deref> SwhLabeledForwardGraph for T
64where
65 <T as Deref>::Target: SwhLabeledForwardGraph,
66{
67 type LabeledArcs<'arc>
68 = <<T as Deref>::Target as SwhLabeledForwardGraph>::LabeledArcs<'arc>
69 where
70 Self: 'arc;
71 type LabeledSuccessors<'succ>
72 = <<T as Deref>::Target as SwhLabeledForwardGraph>::LabeledSuccessors<'succ>
73 where
74 Self: 'succ;
75
76 #[inline(always)]
77 fn untyped_labeled_successors(&self, node_id: NodeId) -> Self::LabeledSuccessors<'_> {
78 self.deref().untyped_labeled_successors(node_id)
79 }
80}
81
82impl<T: Deref> SwhBackwardGraph for T
83where
84 <T as Deref>::Target: SwhBackwardGraph,
85{
86 type Predecessors<'succ>
87 = <<T as Deref>::Target as SwhBackwardGraph>::Predecessors<'succ>
88 where
89 Self: 'succ;
90
91 #[inline(always)]
92 fn predecessors(&self, node_id: NodeId) -> Self::Predecessors<'_> {
93 self.deref().predecessors(node_id)
94 }
95 #[inline(always)]
96 fn indegree(&self, node_id: NodeId) -> usize {
97 self.deref().indegree(node_id)
98 }
99}
100
101impl<T: Deref> SwhLabeledBackwardGraph for T
102where
103 <T as Deref>::Target: SwhLabeledBackwardGraph,
104{
105 type LabeledArcs<'arc>
106 = <<T as Deref>::Target as SwhLabeledBackwardGraph>::LabeledArcs<'arc>
107 where
108 Self: 'arc;
109 type LabeledPredecessors<'succ>
110 = <<T as Deref>::Target as SwhLabeledBackwardGraph>::LabeledPredecessors<'succ>
111 where
112 Self: 'succ;
113
114 #[inline(always)]
115 fn untyped_labeled_predecessors(&self, node_id: NodeId) -> Self::LabeledPredecessors<'_> {
116 self.deref().untyped_labeled_predecessors(node_id)
117 }
118}
119impl<T: Deref> SwhGraphWithProperties for T
120where
121 <T as Deref>::Target: SwhGraphWithProperties,
122{
123 type Maps = <<T as Deref>::Target as SwhGraphWithProperties>::Maps;
124 type Timestamps = <<T as Deref>::Target as SwhGraphWithProperties>::Timestamps;
125 type Persons = <<T as Deref>::Target as SwhGraphWithProperties>::Persons;
126 type Contents = <<T as Deref>::Target as SwhGraphWithProperties>::Contents;
127 type Strings = <<T as Deref>::Target as SwhGraphWithProperties>::Strings;
128 type LabelNames = <<T as Deref>::Target as SwhGraphWithProperties>::LabelNames;
129 #[inline(always)]
130 fn properties(
131 &self,
132 ) -> &properties::SwhGraphProperties<
133 Self::Maps,
134 Self::Timestamps,
135 Self::Persons,
136 Self::Contents,
137 Self::Strings,
138 Self::LabelNames,
139 > {
140 self.deref().properties()
141 }
142}