Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cytoscape-fcose

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cytoscape-fcose

The fCoSE layout for Cytoscape.js by Bilkent with fast compound node placement

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is cytoscape-fcose?

The cytoscape-fcose package is an extension for Cytoscape.js that provides a layout algorithm for graph visualization. It is designed to handle large-scale graphs efficiently and offers features like compound nodes, multi-level nesting, and more.

What are cytoscape-fcose's main functionalities?

Basic Layout

This code initializes a Cytoscape instance with a basic graph containing two nodes and one edge, and applies the fcose layout algorithm to it.

const cy = cytoscape({
  container: document.getElementById('cy'),
  elements: [
    { data: { id: 'a' } },
    { data: { id: 'b' } },
    { data: { id: 'ab', source: 'a', target: 'b' } }
  ],
  style: [
    {
      selector: 'node',
      style: {
        'background-color': '#666',
        'label': 'data(id)'
      }
    },
    {
      selector: 'edge',
      style: {
        'width': 3,
        'line-color': '#ccc'
      }
    }
  ],
  layout: {
    name: 'fcose'
  }
});

Compound Nodes

This code demonstrates the use of compound nodes, where nodes 'b' and 'c' are children of node 'a'. The fcose layout algorithm is applied to arrange the nodes.

const cy = cytoscape({
  container: document.getElementById('cy'),
  elements: [
    { data: { id: 'a' } },
    { data: { id: 'b', parent: 'a' } },
    { data: { id: 'c', parent: 'a' } },
    { data: { id: 'ab', source: 'b', target: 'c' } }
  ],
  style: [
    {
      selector: 'node',
      style: {
        'background-color': '#666',
        'label': 'data(id)'
      }
    },
    {
      selector: 'edge',
      style: {
        'width': 3,
        'line-color': '#ccc'
      }
    }
  ],
  layout: {
    name: 'fcose'
  }
});

Custom Layout Options

This code shows how to customize the fcose layout options, including setting the quality to 'proof', enabling randomization, and adding animation with a duration of 1000 milliseconds.

const cy = cytoscape({
  container: document.getElementById('cy'),
  elements: [
    { data: { id: 'a' } },
    { data: { id: 'b' } },
    { data: { id: 'ab', source: 'a', target: 'b' } }
  ],
  style: [
    {
      selector: 'node',
      style: {
        'background-color': '#666',
        'label': 'data(id)'
      }
    },
    {
      selector: 'edge',
      style: {
        'width': 3,
        'line-color': '#ccc'
      }
    }
  ],
  layout: {
    name: 'fcose',
    quality: 'proof',
    randomize: true,
    animate: true,
    animationDuration: 1000
  }
});

Other packages similar to cytoscape-fcose

Keywords

FAQs

Package last updated on 17 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc