title: VisJs - Get number of edges of a specific node
body: <p>I want to find the number of edges which are connected to a specific node in visjs/javascript.</p>
  
  <p>To illustrate my needs I have made up this example:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Get number of edges of a specific node&lt;/title&gt;
      &lt;script type="text/javascript" src="/home/altug/Downloads/BTAGViewer/libs/visjs/vis.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="mynetwork"&gt;&lt;/div&gt;
      &lt;script type="text/javascript"&gt;
        // create an array with nodes
        var nodes = new vis.DataSet([
          {id: "A", label: 'label A'},
          {id: "B", label: 'label B'},
          {id: "C", label: 'label C'},
          {id: "D", label: 'label D'},
          {id: "E", label: 'label E'}
        ]);
  
        // create an array with edges
        var edges = new vis.DataSet([
          {from: "A", to: "C"},
          {from: "A", to: "B"},
          {from: "B", to: "D"},
          {from: "B", to: "E"}
        ]);
  
        // create a network
        var container = document.getElementById('mynetwork');
        var data = {
          nodes: nodes,
          edges: edges
        };
        var options = {};
        var network = new vis.Network(container, data, options);
  
        var some_id = "B";
        var some_node = nodes.get(some_id);
        console.dir(some_node);
  
        console.log(/*magically retrieve the number of edges for node "B" ---&gt; 3 (for this graph)*/);
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>I know I could iterate over the edges and count the occurences of the specific node id, like for example:</p>
  
  <pre><code>for(var i = 0; i &lt; edges.get().length; i++){
      ...
  }
  </code></pre>
  
  <p><strong><em>But isn't there another possibility using vis.js built-in capabilities?</em></strong></p>