Code Monkey home page Code Monkey logo

Comments (3)

peekxc avatar peekxc commented on June 15, 2024

This ended up being a corner case that happens due to only the way the as_list function works relative to the internal BFS traversal, written eons ago.

I've removed it, since philosophically one has better control over simplex retrieval using the as.list.st_traversal S3 generic, which is also more uniform in that it always reports one simplex per entry in a list form. Indeed, though matrix formats are nice an compact, there is no standard on row vs column orientation, row being more familiar to data scientists and column more familiar to scientific computing and combinatorics people (and more efficient to report, since R is column major)

You can emulate that function now by rolling your own:

library(simplextree)
#> 
#> Attaching package: 'simplextree'
#> The following object is masked from 'package:utils':
#> 
#>     find
#> The following objects are masked from 'package:base':
#> 
#>     remove, serialize
st <- simplex_tree(list(1:3, 2:5, c(6, 7, 9), 7:8, 10))
lapply(seq(0L, st$dimension), function(d){
  do.call(cbind, as.list(k_simplices(st, d)))
})
#> [[1]]
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
#> [1,]    1    2    3    4    5    6    7    8    9    10
#> 
#> [[2]]
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,]    1    1    2    2    2    3    3    4    6     6     7     7
#> [2,]    2    3    3    4    5    4    5    5    7     9     8     9
#> 
#> [[3]]
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    1    2    2    2    3    6
#> [2,]    2    3    3    4    4    7
#> [3,]    3    4    5    5    5    9
#> 
#> [[4]]
#>      [,1]
#> [1,]    2
#> [2,]    3
#> [3,]    4
#> [4,]    5

Created on 2021-07-21 by the reprex package (v2.0.0)

Replacing cbind w/ rbind as needed. Note the use of as.list method dispatch here.

The row-oriented outputs for low dimensional simplices like st$edges should still remain attached at the module level.

from simplextree.

corybrunson avatar corybrunson commented on June 15, 2024

This makes sense! I'll close the issue once i've tried it out on my machine.

from simplextree.

corybrunson avatar corybrunson commented on June 15, 2024

This has been fully resolved in #13 (implementation) and #16 (debugging).

from simplextree.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.