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
// use super::*;
// tests_impls!
// {
// fn node()
// {
// use the_module::prelude::*;
// let mut factory = GenerativeNodeFactory::< the_module::IdentityWithInt >::from();
// let n1 = factory.node_making( 1 );
// let n1b = factory.node( 1 );
// a_id!( n1, n1b.id() );
// dbg!( &n1 );
// let node1a = factory.node( 1 );
// let node1b = factory.node( 1 );
// a_id!( node1a, node1b );
// let node1a = factory.node( &1 );
// let node1b = factory.node( &&1 );
// a_id!( node1a, node1b );
// }
// //
// fn make_default()
// {
// use the_module::prelude::*;
// use type_constructor::from;
// let mut factory : GenerativeNodeFactory::< the_module::IdentityWithInt > = from!();
// let n1 = factory.node_making( 1 );
// let n1b = factory.node( 1 );
// a_id!( n1, n1b.id() );
// }
// //
// fn basic()
// {
// use the_module::prelude::*;
// use type_constructor::from;
// let mut factory = GenerativeNodeFactory::< the_module::IdentityWithInt >::from();
// let a = factory.node_making( 1 );
// let b = factory.node_making( 2 );
// factory.node_add_out_node( a, b );
// factory.node_add_out_nodes( b, [ a, b ].into_iter() );
// a_id!( factory.nnodes(), 2 );
// a_id!( factory.nedges(), 3 );
// dbg!( factory.node( a ) );
// dbg!( factory.node( b ) );
// let got : HashSet< _ > = factory.out_nodes_ids( a ).collect();
// let exp = hset![ b ];
// a_id!( got, exp );
// let got : HashSet< _ > = factory.out_nodes_ids( b ).collect();
// let exp = hset![ a, b ];
// a_id!( got, exp );
// // let got : HashSet< _ > = factory.out_nodes_ids_2( a ).collect();
// // let exp = hset![ b ];
// // a_id!( got, exp );
// // let got : HashSet< _ > = factory.out_nodes_ids_2( b ).collect();
// // let exp = hset![ a, b ];
// // a_id!( got, exp );
// let got : HashSet< _ > = factory.out_edges( a ).map( | el | ( el.1.in_node, el.1.out_node ) ).collect();
// let exp = hset![ ( a, b ) ];
// a_id!( got, exp );
// let got : HashSet< _ > = factory.out_edges( b ).map( | el | ( el.1.in_node, el.1.out_node ) ).collect();
// let exp = hset![ ( b, a ), ( b, b ) ];
// a_id!( got, exp );
// // let got = factory.out_nodes_ids_2( a ).map( | id |
// // {
// // // 13_i32
// // ( id, factory.node( id ) )
// // });
// // use test_tools::inspect_type_of;
// // inspect_type_of!( got );
// }
// // xxx : fix test make_with_edge_list
// fn make_with_edge_list()
// {
// use the_module::prelude::*;
// use type_constructor::from;
// let mut factory = GenerativeNodeFactory::< the_module::IdentityWithInt >::from();
// factory.make_with_edge_list
// ([
// 1, 2,
// 2, 1,
// 2, 2,
// ]);
// dbg!( factory.node( 1 ) );
// dbg!( factory.node( 2 ) );
// let exp = hset![ 2 ];
// let got : HashSet< _ > = factory.out_nodes_ids( 1 ).collect();
// a_id!( got, exp );
// let exp = hset![ 1, 2 ];
// let got : HashSet< _ > = factory.out_nodes_ids( 2 ).collect();
// a_id!( got, exp );
// let got : HashSet< _ > = factory.out_edges( 1 ).map( | el | ( el.1.in_node, el.1.out_node ) ).collect();
// let exp = hset![ ( factory.edge_id( 1 ), factory.edge_id( 2 ) ) ];
// a_id!( got, exp );
// let got : HashSet< _ > = factory.out_edges( 2 ).map( | el | ( el.1.in_node, el.1.out_node ) ).collect();
// let exp = hset![ ( factory.edge_id( 2 ), factory.edge_id( 1 ) ), ( factory.edge_id( 2 ), factory.edge_id( 2 ) ) ];
// // let exp = hset![ factory.edge_ids( 2, 1 ), factory.edge_ids( 2, 2 ) ];
// // let exp : HashSet< ( the_module::IdentityWithInt, the_module::IdentityWithInt ) > = hset![ ( 2, 1 ).into(), ( 2, 2 ).into() ];
// a_id!( got, exp );
// }
// //
// // xxx : fix it
// //
// // fn make_with_edge_list_string()
// // {
// // use the_module::prelude::*;
// //
// // let mut factory = ReadableNodeFactory::< the_module::IdentityWithName >::make();
// //
// // factory.make_with_edge_list
// // ([
// // "A", "B",
// // "B", "A",
// // "B", "B",
// // ]);
// //
// // dbg!( factory.node( "A" ) );
// // dbg!( factory.node( "B" ) );
// //
// // let exp = hset![ "B" ];
// // let got : HashSet< _ > = factory.out_nodes_ids( "A" ).collect();
// // a_id!( got, exp );
// //
// // let exp = hset![ "A", "B" ];
// // let got : HashSet< _ > = factory.out_nodes_ids( "B" ).collect();
// // a_id!( got, exp );
// // }
// //
// fn graph_print()
// {
// use the_module::prelude::*;
// let mut factory = GenerativeNodeFactory::< the_module::IdentityWithInt >::from();
// factory.make_with_edge_list
// ([
// 1, 2,
// 2, 1,
// 2, 2,
// ]);
// let exp = r#"GenerativeNodeFactory
// node::1
// - 2
// node::2
// - 1
// - 2"#;
// let got = format!( "{:?}", factory );
// println!( "{}", got );
// a_id!( got, exp );
// }
// }