GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — Keep nodes without edges in to_networkx by eriknw · Pull Request #646 · python-graphblas/python-graphblas Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #646 +/- ## ========================================== + Coverage 98.29% 98.76% +0.47% ========================================== Files 105 105 Lines 31268 31315 +47 Branches 3657 3661 +4 ========================================== + Hits 30735 30929 +194 + Misses 371 245 -126 + Partials 162 141 -21 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2a59411 to
26e29bc
Compare
26e29bc to
0e6d3b6
Compare
0e6d3b6 to
0901634
Compare
0901634 to
869ab7d
Compare
869ab7d to
55f6469
Compare
55f6469 to
37b4eb4
Compare
37b4eb4 to
47d8398
Compare
47d8398 to
2b63c3f
Compare
2b63c3f to
7dedb5b
Compare
ba1e745 to
cc40fd5
Compare
7f6b5a2 to
710623a
Compare
710623a to
a239ab6
Compare
to_networkx built its DiGraph from the matrix's entries alone, so an index whose row and column are both empty (a node with no edges) vanished, and the nodes came out in the order the sorted entries first named them. A 5x5 matrix with entries (0, 3), (2, 0) and (3, 3) became a graph with nodes [0, 3, 2]; from_networkx then gave back a 3x3 matrix with rows and columns permuted. viz.draw, which draws through to_networkx, left such nodes out of the picture. Add range(nrows) as nodes before the edges, so every row is a node and the nodes iterate in index order, and from_networkx(to_networkx(M)) gives back M. The user guide's line on to_networkx said it always labels the values "weight"; it now says what the nodes are and that edge_attribute names (or drops) the values.
a239ab6 to
3de7549
Compare
Making every row a node cannot work for a Matrix with huge dimensions: for a 2**60 x 2**60 hypersparse Matrix, to_networkx would run out of memory adding nodes (a DiGraph spends about 350 bytes on each). create_isolates=False, from #476, makes nodes only of the indices that have entries. They are still added in index order, so from_networkx gives back the Matrix without its empty rows and columns. With the default create_isolates=True, more than 2**40 rows raise ValueError naming the keyword instead of exhausting memory; a graph that large could never be built. Behavior change: a non-square Matrix raises ValueError. Row i and column i are both node i, which needs a square Matrix; a non-square one gave a graph that mixed row and column indices. The docstring already asked for a square Matrix. Co-authored-by: Sultan Orazbayev <[email protected]>
|
LGTM. @SultanOrazbayev, this pulls in the keyword you added in #476, but defaults to True instead. Sorry I let that PR linger! Things got busy. Thanks for the contribution |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[pyos][io] Conversion to NetworkX drops isolated vertices
There was an error while loading. Please reload this page.