@stdlib/dstructs-compact-adjacency-matrix 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +205 -0
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +32 -0
- package/lib/bit_value.js +45 -0
- package/lib/clear_bit.js +43 -0
- package/lib/from_adjacency_list_iterator.js +61 -0
- package/lib/from_adjacency_list_iterator_map.js +67 -0
- package/lib/from_edges_iterator.js +61 -0
- package/lib/from_edges_iterator_map.js +67 -0
- package/lib/index.js +49 -0
- package/lib/is_set.js +50 -0
- package/lib/main.js +977 -0
- package/lib/set_bit.js +43 -0
- package/package.json +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
package/NOTICE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2021 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>
|
|
24
|
+
About stdlib...
|
|
25
|
+
</summary>
|
|
26
|
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
|
|
27
|
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
|
|
28
|
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
|
|
29
|
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
32
|
+
# CompactAdjacencyMatrix
|
|
33
|
+
|
|
34
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
35
|
+
|
|
36
|
+
> Compact adjacency matrix constructor.
|
|
37
|
+
|
|
38
|
+
<section class="installation">
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install @stdlib/dstructs-compact-adjacency-matrix
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
</section>
|
|
47
|
+
|
|
48
|
+
<section class="usage">
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
var CompactAdjacencyMatrix = require( '@stdlib/dstructs-compact-adjacency-matrix' );
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### CompactAdjacencyMatrix( N )
|
|
57
|
+
|
|
58
|
+
Returns a compact adjacency matrix instance.
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
var adj = new CompactAdjacencyMatrix( 4 );
|
|
62
|
+
// returns <CompactAdjacencyMatrix>
|
|
63
|
+
|
|
64
|
+
// ...
|
|
65
|
+
|
|
66
|
+
adj.addEdge( 0, 1 );
|
|
67
|
+
adj.addEdge( 0, 2 );
|
|
68
|
+
adj.addEdge( 1, 2 );
|
|
69
|
+
adj.addEdge( 2, 3 );
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</section>
|
|
73
|
+
|
|
74
|
+
<!-- /.usage -->
|
|
75
|
+
|
|
76
|
+
<section class="examples">
|
|
77
|
+
|
|
78
|
+
## Examples
|
|
79
|
+
|
|
80
|
+
<!-- eslint-disable @cspell/spellchecker -->
|
|
81
|
+
|
|
82
|
+
<!-- eslint no-undef: "error" -->
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
var CompactAdjacencyMatrix = require( '@stdlib/dstructs-compact-adjacency-matrix' );
|
|
86
|
+
|
|
87
|
+
// Create a new adjacency matrix:
|
|
88
|
+
var adj = new CompactAdjacencyMatrix( 4 );
|
|
89
|
+
|
|
90
|
+
// Add edges:
|
|
91
|
+
adj.addEdge( 1, 0 );
|
|
92
|
+
adj.addEdge( 1, 2 );
|
|
93
|
+
adj.addEdge( 0, 2 );
|
|
94
|
+
adj.addEdge( 2, 3 );
|
|
95
|
+
|
|
96
|
+
// Compute the indegrees and outdegrees for each vertex:
|
|
97
|
+
var id;
|
|
98
|
+
var od;
|
|
99
|
+
var i;
|
|
100
|
+
for ( i = 0; i < 4; i++ ) {
|
|
101
|
+
id = adj.inDegree( i );
|
|
102
|
+
od = adj.outDegree( i );
|
|
103
|
+
console.log( 'vertex: %d. indegree: %d. outdegree: %d.', i, id, od );
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Print the list of all edges:
|
|
107
|
+
console.log( adj.edges );
|
|
108
|
+
// => [ [ 0, 2 ], [ 1, 0 ], [ 1, 2 ], [ 2, 3 ] ]
|
|
109
|
+
|
|
110
|
+
// Convert the adjacency matrix to an adjacency list representation:
|
|
111
|
+
console.log( adj.toAdjacencyList() );
|
|
112
|
+
// => [ [ 2 ], [ 0, 2 ], [ 3 ], [] ]
|
|
113
|
+
|
|
114
|
+
// Compute a topological ordering:
|
|
115
|
+
console.log( adj.toposort() );
|
|
116
|
+
// => [ [ 1, 0, 2, 3 ], null ]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
</section>
|
|
120
|
+
|
|
121
|
+
<!-- /.examples -->
|
|
122
|
+
|
|
123
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
124
|
+
|
|
125
|
+
<section class="related">
|
|
126
|
+
|
|
127
|
+
</section>
|
|
128
|
+
|
|
129
|
+
<!-- /.related -->
|
|
130
|
+
|
|
131
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<section class="main-repo" >
|
|
135
|
+
|
|
136
|
+
* * *
|
|
137
|
+
|
|
138
|
+
## Notice
|
|
139
|
+
|
|
140
|
+
This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
|
|
141
|
+
|
|
142
|
+
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
|
|
143
|
+
|
|
144
|
+
#### Community
|
|
145
|
+
|
|
146
|
+
[![Chat][chat-image]][chat-url]
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
See [LICENSE][stdlib-license].
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
## Copyright
|
|
156
|
+
|
|
157
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
158
|
+
|
|
159
|
+
</section>
|
|
160
|
+
|
|
161
|
+
<!-- /.stdlib -->
|
|
162
|
+
|
|
163
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
164
|
+
|
|
165
|
+
<section class="links">
|
|
166
|
+
|
|
167
|
+
[npm-image]: http://img.shields.io/npm/v/@stdlib/dstructs-compact-adjacency-matrix.svg
|
|
168
|
+
[npm-url]: https://npmjs.org/package/@stdlib/dstructs-compact-adjacency-matrix
|
|
169
|
+
|
|
170
|
+
[test-image]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
171
|
+
[test-url]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/actions/workflows/test.yml?query=branch:v0.1.0
|
|
172
|
+
|
|
173
|
+
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/dstructs-compact-adjacency-matrix/main.svg
|
|
174
|
+
[coverage-url]: https://codecov.io/github/stdlib-js/dstructs-compact-adjacency-matrix?branch=main
|
|
175
|
+
|
|
176
|
+
<!--
|
|
177
|
+
|
|
178
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/dstructs-compact-adjacency-matrix.svg
|
|
179
|
+
[dependencies-url]: https://david-dm.org/stdlib-js/dstructs-compact-adjacency-matrix/main
|
|
180
|
+
|
|
181
|
+
-->
|
|
182
|
+
|
|
183
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
184
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
185
|
+
|
|
186
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
187
|
+
|
|
188
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
189
|
+
|
|
190
|
+
[umd]: https://github.com/umdjs/umd
|
|
191
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
192
|
+
|
|
193
|
+
[deno-url]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/tree/deno
|
|
194
|
+
[deno-readme]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/blob/deno/README.md
|
|
195
|
+
[umd-url]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/tree/umd
|
|
196
|
+
[umd-readme]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/blob/umd/README.md
|
|
197
|
+
[esm-url]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/tree/esm
|
|
198
|
+
[esm-readme]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/blob/esm/README.md
|
|
199
|
+
[branches-url]: https://github.com/stdlib-js/dstructs-compact-adjacency-matrix/blob/main/branches.md
|
|
200
|
+
|
|
201
|
+
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/dstructs-compact-adjacency-matrix/main/LICENSE
|
|
202
|
+
|
|
203
|
+
</section>
|
|
204
|
+
|
|
205
|
+
<!-- /.links -->
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";var m=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var T=m(function(xr,V){"use strict";var K=require("@stdlib/assert-is-collection"),Q=require("@stdlib/string-format");function U(a){var r,t,e;for(r=[];;){if(t=a.next(),e=t.value,e){if(!K(e))return new TypeError(Q("invalid argument. An iterator must return an array-like object containing vertices. Value: `%s`.",e));r.push(e)}if(t.done)break}return r}V.exports=U});var k=m(function(Vr,q){"use strict";var W=require("@stdlib/assert-is-collection"),X=require("@stdlib/string-format");function Z(a,r,t){var e,n,i,u;for(e=[],u=-1;;){if(u+=1,n=a.next(),i=n.value,i){if(i=r.call(t,i,u),!W(i))return new TypeError(X("invalid argument. Callback must return an array-like object containing vertices. Value: `%s`.",i));e.push(i)}if(n.done)break}return e}q.exports=Z});var A=m(function(Tr,N){"use strict";var $=require("@stdlib/assert-is-collection"),rr=require("@stdlib/string-format");function er(a){var r,t,e;for(r=[];;){if(t=a.next(),e=t.value,e){if(!$(e))return new TypeError(rr("invalid argument. An iterator must return an array-like object containing vertices. Value: `%s`.",e));r.push(e[0],e[1])}if(t.done)break}return r}N.exports=er});var R=m(function(qr,M){"use strict";var tr=require("@stdlib/assert-is-collection"),nr=require("@stdlib/string-format");function ir(a,r,t){var e,n,i,u;for(e=[],u=-1;;){if(u+=1,n=a.next(),i=n.value,i){if(i=r.call(t,i,u),!tr(i))return new TypeError(nr("invalid argument. Callback must return an array-like object containing vertices. Value: `%s`.",i));e.push(i[0],i[1])}if(n.done)break}return e}M.exports=ir});var I=m(function(kr,S){"use strict";function ar(a,r){return a|=1<<r,a}S.exports=ar});var F=m(function(Nr,j){"use strict";function or(a,r){return a&=~(1<<r),a}j.exports=or});var L=m(function(Ar,C){"use strict";var ur=require("@stdlib/boolean-ctor");function sr(a,r){return ur(a>>r&1)}C.exports=sr});var O=m(function(Mr,B){"use strict";function vr(a,r){return a>>r&1}B.exports=vr});var J=m(function(Rr,G){"use strict";var g=require("@stdlib/assert-is-nonnegative-integer").isPrimitive,y=require("@stdlib/assert-is-array-like-object"),z=require("@stdlib/assert-is-collection"),p=require("@stdlib/assert-is-function"),D=require("@stdlib/assert-is-object"),fr=require("@stdlib/assert-has-iterator-symbol-support"),b=require("@stdlib/symbol-iterator"),h=require("@stdlib/utils-define-nonenumerable-read-only-property"),x=require("@stdlib/utils-define-nonenumerable-read-only-accessor"),Y=require("@stdlib/array-int32"),lr=require("@stdlib/array-int8"),s=require("@stdlib/string-format"),cr=require("@stdlib/math-base-special-ceil"),gr=require("@stdlib/math-base-special-floor"),hr=require("@stdlib/blas-ext-base-grev"),dr=T(),mr=k(),pr=A(),wr=R(),Er=I(),yr=F(),w=L(),P=O(),H=fr(),_=Y.BYTES_PER_ELEMENT*8;function l(a){if(!(this instanceof l))return new l(a);if(!g(a))throw new TypeError(s("invalid argument. Must provide a nonnegative integer. Value: `%s`.",a));return this._N=a,this._M=0,this._buffer=new Y(cr(a*a/_)),this}h(l,"fromAdjacencyList",function(r){var t,e,n,i,u,v,f,d,o,c;if(!p(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(this!==l)throw new TypeError("invalid invocation. `this` is not a compact adjacency matrix.");if(e=arguments.length,e>1){if(i=arguments[1],!p(i))throw new TypeError(s("invalid argument. Second argument must be a function. Value: `%s`.",i));e>2&&(t=arguments[2])}if(y(r)){if(d=r.length,u=new this(d),i){for(o=0;o<d;o++){if(n=i.call(t,r[o],o),!z(n))throw new TypeError(s("invalid argument. Callback must return an array-like object. Value: `%s`.",n));for(c=0;c<n.length;c++)u.addEdge(o,n[c])}return u}for(o=0;o<d;o++){if(n=r[o],!z(n))throw new TypeError(s("invalid argument. Each element of the adjacency list must be an array-like object. Value: `%s`.",r));for(c=0;c<n.length;c++)u.addEdge(o,n[c])}return u}if(D(r)&&H&&p(r[b])){if(v=r[b](),!p(v.next))throw new TypeError(s("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r));if(i?v=mr(v,i,t):v=dr(v),v instanceof Error)throw v;for(f=v.length,u=new this(f),o=0;o<f;o++)for(n=v[o],c=0;c<n.length;c++)u.addEdge(o,n[c]);return u}throw new TypeError(s("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",r))});h(l,"fromEdges",function(r,t){var e,n,i,u,v,f,d,o;if(!p(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(this!==l)throw new TypeError("invalid invocation. `this` is not a compact adjacency matrix.");if(n=arguments.length,n>2){if(i=arguments[2],!p(i))throw new TypeError(s("invalid argument. Third argument must be a function. Value: `%s`.",i));n>3&&(e=arguments[3])}if(!g(r))throw new TypeError(s("invalid argument. First argument must be a nonnegative integer. Value: `%s`.",r));if(y(t)){if(i){for(v=new this(r),o=0;o<t.length;o++){if(u=i.call(e,t[o],o),!y(u))throw new TypeError(s("invalid argument. Callback must return an array-like object. Value: `%s`.",u));v.addEdge(u[0],u[1])}return v}for(v=new this(r),o=0;o<t.length;o++){if(u=t[o],!y(u))throw new TypeError(s("invalid argument. Each element of the edge list must be an array-like object. Value: `%s`.",u));v.addEdge(u[0],u[1])}return v}if(D(t)&&H&&p(t[b])){if(f=t[b](),!p(f.next))throw new TypeError(s("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",t));if(i?f=wr(f,i,e):f=pr(f),f instanceof Error)throw f;for(d=f.length,v=new this(d/2),o=0;o<d;o+=2)v.addEdge(f[o],f[o+1]);return v}throw new TypeError(s("invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.",t))});h(l.prototype,"_loc",function(r,t,e){var n,i,u;return u=r*this._N+t,n=gr(u/_),i=u-n*_,e[0]=n,e[1]=i,e});h(l.prototype,"addEdge",function(r,t){var e;if(!g(r))throw new TypeError(s("invalid argument. First argument must be a nonnegative integer. Value: `%s`.",r));if(!g(t))throw new TypeError(s("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",t));if(r>=this._N)throw new RangeError(s("invalid argument. First argument exceeds matrix dimensions. Value: `%u`.",r));if(t>=this._N)throw new RangeError(s("invalid argument. Second argument exceeds matrix dimensions. Value: `%u`.",t));return e=this._loc(r,t,[0,0]),w(this._buffer[e[0]],e[1])===!1&&(this._buffer[e[0]]=Er(this._buffer[e[0]],e[1]),this._M+=1),this});x(l.prototype,"edges",function(){var r,t,e,n;for(r=[],t=[0,0],e=0;e<this._N;e++)for(n=0;n<this._N;n++)t=this._loc(e,n,t),w(this._buffer[t[0]],t[1])&&r.push([e,n]);return r});h(l.prototype,"hasEdge",function(r,t){var e;if(!g(r))throw new TypeError(s("invalid argument. First argument must be a nonnegative integer. Value: `%s`.",r));if(!g(t))throw new TypeError(s("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",t));if(r>=this._N)throw new RangeError(s("invalid argument. First argument exceeds matrix dimensions. Value: `%u`.",r));if(t>=this._N)throw new RangeError(s("invalid argument. Second argument exceeds matrix dimensions. Value: `%u`.",t));return e=this._loc(r,t,[0,0]),w(this._buffer[e[0]],e[1])});h(l.prototype,"inDegree",function(r){var t,e,n;if(!g(r))throw new TypeError(s("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(r>=this._N)throw new RangeError(s("invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.",r));for(t=0,e=[0,0],n=0;n<this._N;n++)e=this._loc(n,r,e),t+=P(this._buffer[e[0]],e[1]);return t});h(l.prototype,"inEdges",function(r){var t,e,n;if(!g(r))throw new TypeError(s("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(r>=this._N)throw new RangeError(s("invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.",r));for(t=[],e=[0,0],n=0;n<this._N;n++)e=this._loc(n,r,e),w(this._buffer[e[0]],e[1])&&t.push(n);return t});x(l.prototype,"nedges",function(){return this._M});x(l.prototype,"nvertices",function(){return this._N});h(l.prototype,"outDegree",function(r){var t,e,n;if(!g(r))throw new TypeError(s("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(r>=this._N)throw new RangeError(s("invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.",r));for(t=0,e=[0,0],n=0;n<this._N;n++)e=this._loc(r,n,e),t+=P(this._buffer[e[0]],e[1]);return t});h(l.prototype,"outEdges",function(r){var t,e,n;if(!g(r))throw new TypeError(s("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(r>=this._N)throw new RangeError(s("invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.",r));for(t=[],e=[0,0],n=0;n<this._N;n++)e=this._loc(r,n,e),w(this._buffer[e[0]],e[1])&&t.push(n);return t});h(l.prototype,"removeEdge",function(r,t){var e;if(!g(r))throw new TypeError(s("invalid argument. First argument must be a nonnegative integer. Value: `%s`.",r));if(!g(t))throw new TypeError(s("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",t));if(r>=this._N)throw new RangeError(s("invalid argument. First argument exceeds matrix dimensions. Value: `%u`.",r));if(t>=this._N)throw new RangeError(s("invalid argument. Second argument exceeds matrix dimensions. Value: `%u`.",t));return e=this._loc(r,t,[0,0]),w(this._buffer[e[0]],e[1])&&(this._buffer[e[0]]=yr(this._buffer[e[0]],e[1]),this._M-=1),this});h(l.prototype,"toAdjacencyList",function(){var r,t,e,n,i;for(r=[],t=[0,0],n=0;n<this._N;n++){for(e=[],i=0;i<this._N;i++)t=this._loc(n,i,t),w(this._buffer[t[0]],t[1])&&e.push(i);r.push(e)}return r});h(l.prototype,"toposort",function(){var r,t,e,n,i,u,v,f;if(t=this,u=this._N,e=[],this._N===0)return[e,null];for(r=new lr(u),v=[],n=[0,0],f=0;f<u;f++)if(r[f]===0&&(i=d(f),i!==0))return v.push(f),[null,v];return hr(e.length,e,1),[e,null];function d(o){var c,E;if(r[o]===2)return 0;if(r[o]===1)return-1;for(r[o]=1,E=0;E<u;E++)if(n=t._loc(o,E,n),w(t._buffer[n[0]],n[1])&&(c=d(E),c!==0))return v.push(E),c;return r[o]=2,e.push(o),0}});G.exports=l});var br=J();module.exports=br;
|
|
2
|
+
/**
|
|
3
|
+
* @license Apache-2.0
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2021 The Stdlib Authors.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/from_adjacency_list_iterator.js", "../lib/from_adjacency_list_iterator_map.js", "../lib/from_edges_iterator.js", "../lib/from_edges_iterator_map.js", "../lib/set_bit.js", "../lib/clear_bit.js", "../lib/is_set.js", "../lib/bit_value.js", "../lib/main.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tz = v.value;\n\t\tif ( z ) {\n\t\t\tif ( !isCollection( z ) ) {\n\t\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return an array-like object containing vertices. Value: `%s`.', z ) );\n\t\t\t}\n\t\t\tout.push( z );\n\t\t}\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIterator;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\ti += 1;\n\t\tv = it.next();\n\t\tz = v.value;\n\t\tif ( z ) {\n\t\t\tz = clbk.call( thisArg, z, i );\n\t\t\tif ( !isCollection( z ) ) {\n\t\t\t\treturn new TypeError( format( 'invalid argument. Callback must return an array-like object containing vertices. Value: `%s`.', z ) );\n\t\t\t}\n\t\t\tout.push( z );\n\t\t}\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIteratorMap;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tz = v.value;\n\t\tif ( z ) {\n\t\t\tif ( !isCollection( z ) ) {\n\t\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return an array-like object containing vertices. Value: `%s`.', z ) );\n\t\t\t}\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t}\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIterator;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\ti += 1;\n\t\tv = it.next();\n\t\tz = v.value;\n\t\tif ( z ) {\n\t\t\tz = clbk.call( thisArg, z, i );\n\t\t\tif ( !isCollection( z ) ) {\n\t\t\t\treturn new TypeError( format( 'invalid argument. Callback must return an array-like object containing vertices. Value: `%s`.', z ) );\n\t\t\t}\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t}\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIteratorMap;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Sets a bit.\n*\n* @private\n* @param {integer32} value - integer value\n* @param {NonNegativeInteger} i - bit to set\n* @returns {integer32} updated integer value\n*\n* @example\n* var v = setBit( 0, 2 );\n* // returns 4\n*/\nfunction setBit( value, i ) {\n\tvalue |= 1 << i;\n\treturn value;\n}\n\n\n// EXPORTS //\n\nmodule.exports = setBit;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Clears a bit.\n*\n* @private\n* @param {integer32} value - integer value\n* @param {NonNegativeInteger} i - bit to clear\n* @returns {integer32} updated integer value\n*\n* @example\n* var v = clearBit( 5, 2 );\n* // returns 1\n*/\nfunction clearBit( value, i ) {\n\tvalue &= ~( 1 << i );\n\treturn value;\n}\n\n\n// EXPORTS //\n\nmodule.exports = clearBit;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar Boolean = require( '@stdlib/boolean-ctor' );\n\n\n// MAIN //\n\n/**\n* Checks whether a bit is set.\n*\n* @private\n* @param {integer32} value - integer value\n* @param {NonNegativeInteger} i - bit to check\n* @returns {boolean} boolean indicating whether a bit is set\n*\n* @example\n* var bool = isSet( 4, 2 );\n* // returns true\n*\n* bool = isSet( 4, 0 );\n* // returns false\n*/\nfunction isSet( value, i ) {\n\treturn Boolean( ( value >> i ) & 1 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isSet;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns the value (either `0` or `1`) of a specified bit.\n*\n* @private\n* @param {integer32} value - integer value\n* @param {NonNegativeInteger} i - bit number\n* @returns {NonNegativeInteger} bit value\n*\n* @example\n* var b = bitValue( 4, 2 );\n* // returns 1\n*\n* b = bitValue( 4, 0 );\n* // returns 0\n*/\nfunction bitValue( value, i ) {\n\treturn ( value >> i ) & 1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = bitValue;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable no-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isObject = require( '@stdlib/assert-is-object' );\nvar hasIteratorSymbolSupport = require( '@stdlib/assert-has-iterator-symbol-support' );\nvar ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' );\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar Int32Array = require( '@stdlib/array-int32' );\nvar Int8Array = require( '@stdlib/array-int8' );\nvar format = require( '@stdlib/string-format' );\nvar ceil = require( '@stdlib/math-base-special-ceil' );\nvar floor = require( '@stdlib/math-base-special-floor' );\nvar grev = require( '@stdlib/blas-ext-base-grev' );\nvar fromIteratorAdjList = require( './from_adjacency_list_iterator.js' );\nvar fromIteratorAdjListMap = require( './from_adjacency_list_iterator_map.js' );\nvar fromIteratorEdges = require( './from_edges_iterator.js' );\nvar fromIteratorEdgesMap = require( './from_edges_iterator_map.js' );\nvar setBit = require( './set_bit.js' );\nvar clearBit = require( './clear_bit.js' );\nvar isSet = require( './is_set.js' );\nvar bitValue = require( './bit_value.js' );\n\n\n// VARIABLES //\n\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\nvar NBITS = Int32Array.BYTES_PER_ELEMENT * 8; // 8 bits per byte\n\n\n// MAIN //\n\n/**\n* Compact adjacency matrix constructor.\n*\n* @constructor\n* @param {NonNegativeInteger} N - number of vertices\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {CompactAdjacencyMatrix} adjacency matrix instance\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*/\nfunction CompactAdjacencyMatrix( N ) {\n\tif ( !( this instanceof CompactAdjacencyMatrix ) ) {\n\t\treturn new CompactAdjacencyMatrix( N );\n\t}\n\tif ( !isNonNegativeInteger( N ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', N ) );\n\t}\n\tthis._N = N; // number of vertices\n\tthis._M = 0; // number of edges\n\tthis._buffer = new Int32Array( ceil( N*N/NBITS ) ); // square matrix\n\treturn this;\n}\n\n/**\n* Creates a compact adjacency matrix from an adjacency list.\n*\n* @name fromAdjacencyList\n* @memberof CompactAdjacencyMatrix\n* @type {Function}\n* @param {(ArrayLikeObject|Iterable)} list - adjacency list\n* @param {Function} [clbk] - callback to invoke for each list element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a compact adjacency matrix\n* @throws {TypeError} first argument must be an array-like object or an iterable\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} each element of a provided adjacency list must be an array-like object\n* @throws {TypeError} an iterator must return an array-like object containing vertices\n* @throws {TypeError} when provided an iterator, a callback must return an array-like object containing vertices\n* @returns {CompactAdjacencyMatrix} adjacency matrix instance\n*\n* @example\n* var list = [ [ 1, 2 ], [ 2 ], [ 3 ], [] ];\n*\n* var adj = CompactAdjacencyMatrix.fromAdjacencyList( list );\n* // returns <CompactAdjacencyMatrix>\n*\n* var bool = adj.hasEdge( 0, 1 );\n* // returns true\n*\n* bool = adj.hasEdge( 0, 2 );\n* // returns true\n*\n* bool = adj.hasEdge( 1, 2 );\n* // returns true\n*\n* bool = adj.hasEdge( 2, 3 );\n* // returns true\n*/\nsetReadOnly( CompactAdjacencyMatrix, 'fromAdjacencyList', function fromAdjacencyList( list ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar edges;\n\tvar clbk;\n\tvar adj;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( this !== CompactAdjacencyMatrix ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a compact adjacency matrix.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\tclbk = arguments[ 1 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tif ( nargs > 2 ) {\n\t\t\tthisArg = arguments[ 2 ];\n\t\t}\n\t}\n\tif ( isArrayLikeObject( list ) ) {\n\t\tN = list.length;\n\t\tadj = new this( N );\n\t\tif ( clbk ) {\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tedges = clbk.call( thisArg, list[ i ], i );\n\t\t\t\tif ( !isCollection( edges ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return an array-like object. Value: `%s`.', edges ) );\n\t\t\t\t}\n\t\t\t\tfor ( j = 0; j < edges.length; j++ ) {\n\t\t\t\t\tadj.addEdge( i, edges[ j ] );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn adj;\n\t\t}\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tedges = list[ i ];\n\t\t\tif ( !isCollection( edges ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Each element of the adjacency list must be an array-like object. Value: `%s`.', list ) );\n\t\t\t}\n\t\t\tfor ( j = 0; j < edges.length; j++ ) {\n\t\t\t\tadj.addEdge( i, edges[ j ] );\n\t\t\t}\n\t\t}\n\t\treturn adj;\n\t}\n\tif ( isObject( list ) && HAS_ITERATOR_SYMBOL && isFunction( list[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\ttmp = list[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( tmp.next ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', list ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorAdjListMap( tmp, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIteratorAdjList( tmp );\n\t\t}\n\t\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length;\n\t\tadj = new this( len );\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tedges = tmp[ i ];\n\t\t\tfor ( j = 0; j < edges.length; j++ ) {\n\t\t\t\tadj.addEdge( i, edges[ j ] );\n\t\t\t}\n\t\t}\n\t\treturn adj;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', list ) );\n});\n\n/**\n* Creates a compact adjacency matrix from a list of edges.\n*\n* @name fromEdges\n* @memberof CompactAdjacencyMatrix\n* @type {Function}\n* @param {NonNegativeInteger} N - number of vertices\n* @param {(ArrayLikeObject|Iterable)} edges - list of edges\n* @param {Function} [clbk] - callback to invoke for each list element\n* @param {*} [thisArg] - context\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a compact adjacency matrix\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be an array-like object\n* @throws {TypeError} third argument must be a function\n* @throws {TypeError} each element of a provided list of edges must be a two-element array-like object containing vertices\n* @throws {TypeError} an iterator must return a two-element array-like object containing vertices\n* @throws {TypeError} when provided an iterator, a callback must return a two-element array-like object containing vertices\n* @returns {CompactAdjacencyMatrix} adjacency matrix instance\n*\n* @example\n* var edges = [ [ 0, 1 ], [ 0, 2 ], [ 1, 2 ], [ 2, 3 ] ];\n*\n* var adj = CompactAdjacencyMatrix.fromEdges( 4, edges );\n* // returns <CompactAdjacencyMatrix>\n*\n* var bool = adj.hasEdge( 0, 1 );\n* // returns true\n*\n* bool = adj.hasEdge( 0, 2 );\n* // returns true\n*\n* bool = adj.hasEdge( 1, 2 );\n* // returns true\n*\n* bool = adj.hasEdge( 2, 3 );\n* // returns true\n*/\nsetReadOnly( CompactAdjacencyMatrix, 'fromEdges', function fromEdges( N, edges ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar edge;\n\tvar adj;\n\tvar tmp;\n\tvar len;\n\tvar i;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( this !== CompactAdjacencyMatrix ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a compact adjacency matrix.' );\n\t}\n\tnargs = arguments.length;\n\tif ( nargs > 2 ) {\n\t\tclbk = arguments[ 2 ];\n\t\tif ( !isFunction( clbk ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', clbk ) );\n\t\t}\n\t\tif ( nargs > 3 ) {\n\t\t\tthisArg = arguments[ 3 ];\n\t\t}\n\t}\n\tif ( !isNonNegativeInteger( N ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', N ) );\n\t}\n\tif ( isArrayLikeObject( edges ) ) {\n\t\tif ( clbk ) {\n\t\t\tadj = new this( N );\n\t\t\tfor ( i = 0; i < edges.length; i++ ) {\n\t\t\t\tedge = clbk.call( thisArg, edges[ i ], i );\n\t\t\t\tif ( !isArrayLikeObject( edge ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return an array-like object. Value: `%s`.', edge ) );\n\t\t\t\t}\n\t\t\t\tadj.addEdge( edge[ 0 ], edge[ 1 ] );\n\t\t\t}\n\t\t\treturn adj;\n\t\t}\n\t\tadj = new this( N );\n\t\tfor ( i = 0; i < edges.length; i++ ) {\n\t\t\tedge = edges[ i ];\n\t\t\tif ( !isArrayLikeObject( edge ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Each element of the edge list must be an array-like object. Value: `%s`.', edge ) );\n\t\t\t}\n\t\t\tadj.addEdge( edge[ 0 ], edge[ 1 ] );\n\t\t}\n\t\treturn adj;\n\t}\n\n\tif ( isObject( edges ) && HAS_ITERATOR_SYMBOL && isFunction( edges[ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len\n\t\ttmp = edges[ ITERATOR_SYMBOL ]();\n\t\tif ( !isFunction( tmp.next ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.', edges ) );\n\t\t}\n\t\tif ( clbk ) {\n\t\t\ttmp = fromIteratorEdgesMap( tmp, clbk, thisArg );\n\t\t} else {\n\t\t\ttmp = fromIteratorEdges( tmp );\n\t\t}\n\t\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length;\n\t\tadj = new this( len/2 );\n\t\tfor ( i = 0; i < len; i += 2 ) {\n\t\t\tadj.addEdge( tmp[ i ], tmp[ i+1 ] );\n\t\t}\n\t\treturn adj;\n\t}\n\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.', edges ) );\n});\n\n/**\n* Returns indices (\"bucket\" and bit offset) for an `(i,j)` vertex pair.\n*\n* @private\n* @name _loc\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} i - starting vertex\n* @param {NonNegativeInteger} j - ending vertex\n* @param {Array} out - output array\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} first argument must not exceed matrix dimensions\n* @throws {RangeError} second argument must not exceed matrix dimensions\n* @returns {Array} output array\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, '_loc', function loc( i, j, out ) {\n\tvar bucket;\n\tvar bit;\n\tvar idx;\n\n\t// Compute a strided index for the desired bit:\n\tidx = ( i*this._N ) + j;\n\n\t// Compute the index of the buffer element (bucket) containing the bit:\n\tbucket = floor( idx / NBITS );\n\n\t// Compute the bit offset:\n\tbit = idx - ( bucket*NBITS );\n\n\t// Set the output values:\n\tout[ 0 ] = bucket;\n\tout[ 1 ] = bit;\n\n\treturn out;\n});\n\n/**\n* Adds a directed edge between two vertices.\n*\n* @name addEdge\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} i - starting vertex\n* @param {NonNegativeInteger} j - ending vertex\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} first argument must not exceed matrix dimensions\n* @throws {RangeError} second argument must not exceed matrix dimensions\n* @returns {CompactAdjacencyMatrix} adjacency matrix instance\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'addEdge', function addEdge( i, j ) {\n\tvar idx;\n\tif ( !isNonNegativeInteger( i ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', i ) );\n\t}\n\tif ( !isNonNegativeInteger( j ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', j ) );\n\t}\n\tif ( i >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. First argument exceeds matrix dimensions. Value: `%u`.', i ) );\n\t}\n\tif ( j >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Second argument exceeds matrix dimensions. Value: `%u`.', j ) );\n\t}\n\t// Resolve the `(i,j)` pair:\n\tidx = this._loc( i, j, [ 0, 0 ] );\n\n\t// Set the bit for the edge:\n\tif ( isSet( this._buffer[ idx[0] ], idx[1] ) === false ) {\n\t\tthis._buffer[ idx[0] ] = setBit( this._buffer[ idx[0] ], idx[1] );\n\t\tthis._M += 1;\n\t}\n\treturn this;\n});\n\n/**\n* Returns the list of all edges.\n*\n* @name edges\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Array}\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* var edges = adj.edges;\n* // returns [ [ 0, 1 ], [ 0, 2 ], [ 1, 2 ], [ 2, 3 ] ]\n*/\nsetReadOnlyAccessor( CompactAdjacencyMatrix.prototype, 'edges', function edges() {\n\tvar edges;\n\tvar idx;\n\tvar i;\n\tvar j;\n\n\tedges = [];\n\tidx = [ 0, 0 ];\n\tfor ( i = 0; i < this._N; i++ ) {\n\t\tfor ( j = 0; j < this._N; j++ ) {\n\t\t\t// Resolve the `(i,j)` pair:\n\t\t\tidx = this._loc( i, j, idx );\n\n\t\t\t// Check for an edge:\n\t\t\tif ( isSet( this._buffer[ idx[0] ], idx[1] ) ) {\n\t\t\t\tedges.push( [ i, j ] );\n\t\t\t}\n\t\t}\n\t}\n\treturn edges;\n});\n\n/**\n* Checks whether a directed edge exists between two vertices.\n*\n* @name hasEdge\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} i - starting vertex\n* @param {NonNegativeInteger} j - ending vertex\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} first argument must not exceed matrix dimensions\n* @throws {RangeError} second argument must not exceed matrix dimensions\n* @returns {boolean} boolean indicating if an edge exists\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* // ...\n*\n* var bool = adj.hasEdge( 0, 1 );\n* // returns true\n*\n* bool = adj.hasEdge( 0, 2 );\n* // returns true\n*\n* bool = adj.hasEdge( 1, 2 );\n* // returns true\n*\n* bool = adj.hasEdge( 2, 3 );\n* // returns true\n*\n* bool = adj.hasEdge( 1, 3 );\n* // returns false\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'hasEdge', function hasEdge( i, j ) {\n\tvar idx;\n\tif ( !isNonNegativeInteger( i ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', i ) );\n\t}\n\tif ( !isNonNegativeInteger( j ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', j ) );\n\t}\n\tif ( i >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. First argument exceeds matrix dimensions. Value: `%u`.', i ) );\n\t}\n\tif ( j >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Second argument exceeds matrix dimensions. Value: `%u`.', j ) );\n\t}\n\t// Resolve the `(i,j)` pair:\n\tidx = this._loc( i, j, [ 0, 0 ] );\n\n\t// Check for an edge:\n\treturn isSet( this._buffer[ idx[0] ], idx[1] );\n});\n\n/**\n* Returns the indegree of a vertex (i.e., number of edges ending at a vertex).\n*\n* @name inDegree\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} j - vertex\n* @throws {TypeError} must provide a nonnegative integer\n* @throws {RangeError} must not exceed matrix dimensions\n* @returns {NonNegativeInteger} indegree\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* var d = adj.inDegree( 2 );\n* // returns 2\n*\n* d = adj.inDegree( 3 );\n* // returns 1\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'inDegree', function inDegree( j ) {\n\tvar deg;\n\tvar idx;\n\tvar i;\n\tif ( !isNonNegativeInteger( j ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', j ) );\n\t}\n\tif ( j >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.', j ) );\n\t}\n\t// Iterate over the rows and add up the number of edges...\n\tdeg = 0;\n\tidx = [ 0, 0 ];\n\tfor ( i = 0; i < this._N; i++ ) {\n\t\t// Resolve the `(i,j)` pair:\n\t\tidx = this._loc( i, j, idx );\n\n\t\t// Check for an edge:\n\t\tdeg += bitValue( this._buffer[ idx[0] ], idx[1] );\n\t}\n\treturn deg;\n});\n\n/**\n* Returns a list of vertices having edges ending at a specified vertex.\n*\n* @name inEdges\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} j - vertex\n* @throws {TypeError} must provide a nonnegative integer\n* @throws {RangeError} must not exceed matrix dimensions\n* @returns {Array} list of vertices\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* var e = adj.inEdges( 2 );\n* // returns [ 0, 1 ]\n*\n* e = adj.inEdges( 3 );\n* // returns [ 2 ]\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'inEdges', function inEdges( j ) {\n\tvar edges;\n\tvar idx;\n\tvar i;\n\tif ( !isNonNegativeInteger( j ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', j ) );\n\t}\n\tif ( j >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.', j ) );\n\t}\n\t// Iterate over the rows and retrieve edges...\n\tedges = [];\n\tidx = [ 0, 0 ];\n\tfor ( i = 0; i < this._N; i++ ) {\n\t\t// Resolve the `(i,j)` pair:\n\t\tidx = this._loc( i, j, idx );\n\n\t\t// Check for an edge:\n\t\tif ( isSet( this._buffer[ idx[0] ], idx[1] ) ) {\n\t\t\tedges.push( i );\n\t\t}\n\t}\n\treturn edges;\n});\n\n/**\n* Returns the total number of edges.\n*\n* @name nedges\n* @memberof CompactAdjacencyMatrix.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* // ...\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n*\n* // ...\n*\n* var M = adj.nedges;\n* // returns 3\n*/\nsetReadOnlyAccessor( CompactAdjacencyMatrix.prototype, 'nedges', function nedges() {\n\treturn this._M;\n});\n\n/**\n* Returns the number of vertices.\n*\n* @name nvertices\n* @memberof CompactAdjacencyMatrix.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* // ...\n*\n* var N = adj.nvertices;\n* // returns 4\n*/\nsetReadOnlyAccessor( CompactAdjacencyMatrix.prototype, 'nvertices', function nvertices() {\n\treturn this._N;\n});\n\n/**\n* Returns the outdegree of a vertex (i.e., number of edges starting from a vertex).\n*\n* @name outDegree\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} i - vertex\n* @throws {TypeError} must provide a nonnegative integer\n* @throws {RangeError} must not exceed matrix dimensions\n* @returns {NonNegativeInteger} outdegree\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* var d = adj.outDegree( 2 );\n* // returns 1\n*\n* d = adj.outDegree( 0 );\n* // returns 2\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'outDegree', function outDegree( i ) {\n\tvar deg;\n\tvar idx;\n\tvar j;\n\tif ( !isNonNegativeInteger( i ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', i ) );\n\t}\n\tif ( i >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.', i ) );\n\t}\n\t// Iterate over the columns and add up the number of edges...\n\tdeg = 0;\n\tidx = [ 0, 0 ];\n\tfor ( j = 0; j < this._N; j++ ) {\n\t\t// Resolve the `(i,j)` pair:\n\t\tidx = this._loc( i, j, idx );\n\n\t\t// Check for an edge:\n\t\tdeg += bitValue( this._buffer[ idx[0] ], idx[1] );\n\t}\n\treturn deg;\n});\n\n/**\n* Returns a list of vertices having edges starting at a specified vertex.\n*\n* @name outEdges\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} i - vertex\n* @throws {TypeError} must provide a nonnegative integer\n* @throws {RangeError} must not exceed matrix dimensions\n* @returns {Array} list of vertices\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* var e = adj.outEdges( 2 );\n* // returns [ 3 ]\n*\n* e = adj.outEdges( 0 );\n* // returns [ 1, 2 ]\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'outEdges', function outEdges( i ) {\n\tvar edges;\n\tvar idx;\n\tvar j;\n\tif ( !isNonNegativeInteger( i ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', i ) );\n\t}\n\tif ( i >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Vertex cannot exceed matrix dimensions. Value: `%u`.', i ) );\n\t}\n\t// Iterate over the rows and retrieve edges...\n\tedges = [];\n\tidx = [ 0, 0 ];\n\tfor ( j = 0; j < this._N; j++ ) {\n\t\t// Resolve the `(i,j)` pair:\n\t\tidx = this._loc( i, j, idx );\n\n\t\t// Check for an edge:\n\t\tif ( isSet( this._buffer[ idx[0] ], idx[1] ) ) {\n\t\t\tedges.push( j );\n\t\t}\n\t}\n\treturn edges;\n});\n\n/**\n* Removes a directed edge between two vertices.\n*\n* @name removeEdge\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @param {NonNegativeInteger} i - starting vertex\n* @param {NonNegativeInteger} j - ending vertex\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} first argument must not exceed matrix dimensions\n* @throws {RangeError} second argument must not exceed matrix dimensions\n* @returns {CompactAdjacencyMatrix} adjacency matrix instance\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* // ...\n*\n* adj.removeEdge( 0, 1 );\n* adj.removeEdge( 0, 2 );\n* adj.removeEdge( 1, 2 );\n* adj.removeEdge( 2, 3 );\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'removeEdge', function removeEdge( i, j ) {\n\tvar idx;\n\tif ( !isNonNegativeInteger( i ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', i ) );\n\t}\n\tif ( !isNonNegativeInteger( j ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', j ) );\n\t}\n\tif ( i >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. First argument exceeds matrix dimensions. Value: `%u`.', i ) );\n\t}\n\tif ( j >= this._N ) {\n\t\tthrow new RangeError( format( 'invalid argument. Second argument exceeds matrix dimensions. Value: `%u`.', j ) );\n\t}\n\t// Resolve the `(i,j)` pair:\n\tidx = this._loc( i, j, [ 0, 0 ] );\n\n\t// Clear the bit for the edge:\n\tif ( isSet( this._buffer[ idx[0] ], idx[1] ) ) {\n\t\tthis._buffer[ idx[0] ] = clearBit( this._buffer[ idx[0] ], idx[1] );\n\t\tthis._M -= 1;\n\t}\n\treturn this;\n});\n\n/**\n* Returns an adjacency list representation.\n*\n* @name toAdjacencyList\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @returns {Array} adjacency list representation\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* var list = adj.toAdjacencyList();\n* // returns [ [ 1, 2 ], [ 2 ], [ 3 ], [] ]\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'toAdjacencyList', function toAdjacencyList() {\n\tvar list;\n\tvar idx;\n\tvar tmp;\n\tvar i;\n\tvar j;\n\n\tlist = [];\n\tidx = [ 0, 0 ];\n\tfor ( i = 0; i < this._N; i++ ) {\n\t\ttmp = [];\n\t\tfor ( j = 0; j < this._N; j++ ) {\n\t\t\t// Resolve the `(i,j)` pair:\n\t\t\tidx = this._loc( i, j, idx );\n\n\t\t\t// Check for an edge:\n\t\t\tif ( isSet( this._buffer[ idx[0] ], idx[1] ) ) {\n\t\t\t\ttmp.push( j );\n\t\t\t}\n\t\t}\n\t\tlist.push( tmp );\n\t}\n\treturn list;\n});\n\n/**\n* Returns a topological ordering of the directed graph.\n*\n* ## Notes\n*\n* - The function returns a two-element array.\n* - If the function is able to compute a topological ordering, the first array element is the topological ordering and the second element is `null`.\n* - If a topological ordering cannot be achieved (e.g., due to the graph not being a directed acyclic graph (DAG)), the first array element is `null` and the second element is the first encountered cycle.\n*\n* @name toposort\n* @memberof CompactAdjacencyMatrix.prototype\n* @type {Function}\n* @returns {Array} topological ordering\n*\n* @example\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* adj.addEdge( 1, 0 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 2, 3 );\n*\n* var results = adj.toposort();\n* // returns <Array>\n*\n* var order = results[ 0 ];\n* // returns [ 1, 0, 2, 3 ]\n*\n* var cycle = results[ 1 ];\n* // returns null\n*/\nsetReadOnly( CompactAdjacencyMatrix.prototype, 'toposort', function toposort() {\n\tvar marks;\n\tvar self;\n\tvar out;\n\tvar idx;\n\tvar err;\n\tvar N;\n\tvar s;\n\tvar i;\n\n\tself = this;\n\tN = this._N;\n\n\t// Initialize an empty list that will contain the sorted vertices:\n\tout = [];\n\n\t// If the graph is empty, nothing to sort...\n\tif ( this._N === 0 ) {\n\t\treturn [ out, null ];\n\t}\n\t// Initialize an array for keeping track of whether a vertex has been \"visited\":\n\tmarks = new Int8Array( N );\n\n\t// Initialize a stack for keeping track of cycles:\n\ts = [];\n\n\t// Process vertices using depth-first-search...\n\tidx = [ 0, 0 ];\n\tfor ( i = 0; i < N; i++ ) {\n\t\tif ( marks[ i ] === 0 ) {\n\t\t\terr = visit( i );\n\t\t\tif ( err !== 0 ) {\n\t\t\t\t// Found a cycle...\n\t\t\t\ts.push( i );\n\t\t\t\treturn [ null, s ];\n\t\t\t}\n\t\t}\n\t}\n\t// Reverse the output array as the leaves were added first, followed the by the roots, via depth-first-search:\n\tgrev( out.length, out, 1 );\n\n\treturn [ out, null ];\n\n\t/**\n\t* Visits a graph vertex and follows edges until finding a leaf vertex (if one exists).\n\t*\n\t* ## Notes\n\t*\n\t* - If the function is able to successfully perform a depth-first-search, the functions returns `0`; otherwise, the function returns `-1` in the event of a cycle.\n\t*\n\t* @private\n\t* @param {NonNegativeInteger} i - vertex\n\t* @returns {integer} error code\n\t*/\n\tfunction visit( i ) {\n\t\tvar err;\n\t\tvar j;\n\n\t\t// Check if we've already processed/visited this vertex...\n\t\tif ( marks[ i ] === 2 ) {\n\t\t\treturn 0;\n\t\t}\n\t\t// Check if we've seen this vertex before and the vertex is still being processed...\n\t\tif ( marks[ i ] === 1 ) {\n\t\t\t// We've found a cycle...\n\t\t\treturn -1;\n\t\t}\n\t\t// Mark the current vertex as currently being processed:\n\t\tmarks[ i ] = 1;\n\n\t\t// Follow all edges from the current vertex...\n\t\tfor ( j = 0; j < N; j++ ) {\n\t\t\tidx = self._loc( i, j, idx ); // eslint-disable-line no-underscore-dangle\n\t\t\tif ( isSet( self._buffer[ idx[0] ], idx[1] ) ) { // eslint-disable-line no-underscore-dangle\n\t\t\t\terr = visit( j );\n\t\t\t\tif ( err !== 0 ) {\n\t\t\t\t\t// This vertex is part of a cycle, so add to cycle stack...\n\t\t\t\t\ts.push( j );\n\t\t\t\t\treturn err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Mark the current vertex as processed:\n\t\tmarks[ i ] = 2;\n\n\t\t// Add to the output array now that all subsequent vertices (relative to this vertex) in the graph have already been added to the output array:\n\t\tout.push( i );\n\n\t\treturn 0;\n\t}\n});\n\n\n// EXPORTS //\n\nmodule.exports = CompactAdjacencyMatrix;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Compact adjacency matrix.\n*\n* @module @stdlib/dstructs-compact-adjacency-matrix\n*\n* @example\n* var CompactAdjacencyMatrix = require( '@stdlib/dstructs-compact-adjacency-matrix' );\n*\n* var adj = new CompactAdjacencyMatrix( 4 );\n* // returns <CompactAdjacencyMatrix>\n*\n* // ...\n*\n* adj.addEdge( 0, 1 );\n* adj.addEdge( 0, 2 );\n* adj.addEdge( 1, 2 );\n* adj.addEdge( 2, 3 );\n*\n* // ...\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GA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"fromIterator", "it", "out", "v", "z", "require_from_adjacency_list_iterator_map", "__commonJSMin", "exports", "module", "isCollection", "format", "fromIteratorMap", "it", "clbk", "thisArg", "out", "v", "z", "i", "require_from_edges_iterator", "__commonJSMin", "exports", "module", "isCollection", "format", "fromIterator", "it", "out", "v", "z", "require_from_edges_iterator_map", "__commonJSMin", "exports", "module", "isCollection", "format", "fromIteratorMap", "it", "clbk", "thisArg", "out", "v", "z", "i", "require_set_bit", "__commonJSMin", "exports", "module", "setBit", "value", "i", "require_clear_bit", "__commonJSMin", "exports", "module", "clearBit", "value", "i", "require_is_set", "__commonJSMin", "exports", "module", "Boolean", "isSet", "value", "i", "require_bit_value", "__commonJSMin", "exports", "module", "bitValue", "value", "i", "require_main", "__commonJSMin", "exports", "module", "isNonNegativeInteger", "isArrayLikeObject", "isCollection", "isFunction", "isObject", "hasIteratorSymbolSupport", "ITERATOR_SYMBOL", "setReadOnly", "setReadOnlyAccessor", "Int32Array", "Int8Array", "format", "ceil", "floor", "grev", "fromIteratorAdjList", "fromIteratorAdjListMap", "fromIteratorEdges", "fromIteratorEdgesMap", "setBit", "clearBit", "isSet", "bitValue", "HAS_ITERATOR_SYMBOL", "NBITS", "CompactAdjacencyMatrix", "N", "list", "thisArg", "nargs", "edges", "clbk", "adj", "tmp", "len", "i", "j", "edge", "out", "bucket", "bit", "idx", "deg", "marks", "self", "err", "s", "visit", "main"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* TODO
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // TODO
|
|
26
|
+
*/
|
|
27
|
+
declare function todo(): void;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// EXPORTS //
|
|
31
|
+
|
|
32
|
+
export = todo;
|