Assignment 0 (Coding): Combinatorial Surfaces — due 2/7

For the coding portion of your first assignment, you will implement some operations on simplicial complexes which were discussed in class and in Chapter 2 of the course notes. Once implemented, you will be able to select simplices and apply these operations to them by clicking the appropriate buttons in the viewer (shown above).

Getting Started

  • Please download or clone the files in this repository. It contains a fast and flexible framework for 3D geometry processing implemented in Javascript. Over the course of the semester, you will implement all of your coding assignments here.
  • For this assignment, you will need to implement the following routines in projects/simplicial-complex-operators/simplicial-complex-operators.js:
    • assignElementIndices
    • buildVertexEdgeAdjacencymatrix
    • buildEdgeFaceAdjacencymatrix
    • buildVertexVector
    • buildEdgeVector
    • buildFaceVector
    • star
    • closure
    • link
    • isComplex
    • isPureComplex
    • boundary


  • This assignment comes with a viewer projects/simplicial-complex-operators/index.html which lets you apply your operators to simplices of meshes and visualize the results.
  • Selecting simplices will not work until you fill in the assignElementIndices function.
  • The assignment also comes with a test script tests/simplicial-complex-operators/text.html which you can use to verify the correctness of your operators.
  • The code framework is implemented in Javascript, which means no compilation or installation is necessary on any platform. You can simply get started by opening the index.html file in projects/discrete-exterior-calculus/ in a web browser. We recommend using Chrome or Firefox. Safari has poor WebGL performance.
  • If you do not have prior experience with Javascript, do not worry! You should be able to get a handle on Javascript syntax by reading through some of the code in the framework (a good place to start might be core/geometry.js). The framework also contains extensive documentation (see docs/index.html).
  • All browsers come with tools for debugging (for instance the JavaScript Console in Chrome).

Submission Instructions

Please rename your simplicial-complex-operators.js file to simplicial-complex-operators.txt and submit it in a zip file called to

8 thoughts on “Assignment 0 (Coding): Combinatorial Surfaces — due 2/7”

  1. Should buildVertexEdgeAdjacencymatrix and buildEdgeFaceAdjacencymatrix return a DenseMatrix or a SparseMatrix? Using a DenseMatrix seems to cause the test script to timeout due to the large number of 0’s, but it seems like the function definition wants us to return a DenseMatrix (i.e. @returns {module:LinearAlgebra.DenseMatrix}).

    Also, the test script seems to add only vertices to the subset when testing buildEdgeVector, which means subset.edges is empty. Do we need to account for this possibility and manually check for possible edges using subset.vertices? The same question applies for buildFaceVector.

    1. To rephrase the 2nd question: given a mesh M with V ={a,b} and E = {ab}, and a subset S with V = {a,b} and E = {}, should buildEdgeVector just return the 0 vector?

    2. Sorry, the DenseMatrix in the function definition is a typo. You should return a SparseMatrix. Hopefully that resolves your memory issues.

      You don’t need to add in edges connecting vertices in subset.vertices. That was another typo in the test script (although it doesn’t really matter since it’s just checking the vector’s size).

  2. DDG19A0
    Is execution time a part of the grading scheme? Many of the tests I ran are marked with a red label with execution time, does that mean the execution time for these tests is too long? Moreover, after one of the test got timed out, every single test afterwards got timeouts or “Error: the string “abort(\”Cannot enlarge memory arrays.” (seems to be overflow?) Is this normal?
    Thanks a lot!

    1. As long as the test finishes, you don’t need to worry about execution time. But none of them should time out. Are you having the same sparse vs dense matrix problem that people were having above?

Leave a Reply