title: Length of a list in O(1)
body: <p>I'm currently writing my master's thesis about a graph algorithm. I’m getting a graph passed as an adjacency list. Then I save it in different data structures to be able to perform the operations in the algorithm in O (1). However, I also need to find out and save the degree of each node. The length of the adjacency lists corresponds to the degree of the vertices. How can I find out the length of the adjacency lists in O(1)? I can also add/use another data structure.</p>
  <p>Thank you for any help!</p>
  <p>Lisa</p>