All notes
Cytoscap

Intro

Starting example

blog.js.cytoscape.org.



<!doctype html>
<html>

<head>
  <title>Tutorial 1: Getting Started</title>
  <script src="./cytoscape.min.js"></script>
  <style>
    #cy {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0px;
      left: 0px;
    }
  </style>
</head>

<body>
  <div id="cy"></div>
  <script>
    var cy = cytoscape({
      container: document.getElementById('cy'),
      elements: [
        { data: { id: 'a' } },
        { data: { id: 'b' } },
        {
          data: {
            id: 'ab',
            source: 'a',
            target: 'b'
          }
        }],
        style: [
            {
                selector: 'node',
                style: {
                    shape: 'hexagon',
                    'background-color': 'red'
                }
            }]      
    });
  </script>
</body>
</html>