Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
avsdf-base
Advanced tools
Readme
avsdf-base is a JavaScript library that constitutes of elements helpful in applying the Circular Drawing Algorithm by Hongmei He & Ondrej Sýkora.
Elements of layout-base can be accessed through this library as well. See below for an example.
Add avsdf-base
as a dependecy to your layout extension.
require()
in the extension to reach functionality:
const AVSDFLayout = require('avsdf-base').AVSDFLayout;
const AVSDFNode = require('avsdf-base').AVSDFNode;
const AVSDFConstants = require('avsdf-base').AVSDFConstants;
const PointD = require('avsdf-base').layoutBase.PointD;
const DimensionD = require('avsdf-base').layoutBase.DimensionD;
The main layout and a Graph Manager (see layout-base for details) connected to this layout is needed with
let avsdfLayout = new AVSDFLayout();
let graphManager = avsdfLayout.newGraphManager();
let root = graphManager.addRoot();
Filling in the Graph Manager with nodes and edges are more related to layout-base library than this library. So details have to be found there. But remember to add AVSDF elements as opposed to layout-base elements. Also remember that the root of the Graph Manager should be an AVSDFCircle object.
// Adding a node
Let node = root.add(new AVSDFNode(graphManager));
// Adding an edge
Let edge = graphManager.add(avsdfLayout.newEdge(), sourceNode, targetNode);
After all nodes and edges are added. The algorithm can be run as shown below.
// Running the AVSDF layout.
avsdfLayout.layout();
// Post process is iterated over the sorted list of vertex degrees (descending)
let sortedByDegreeList = avsdfLayout.initPostProcess();
// Post process is done step by step so that it could be displayed more efficiently
for (node in sortedByDegreeList) {
avsdfLayout.oneStepPostProcess(node);
}
// An update for the angles (in radians) for the node angles are needed
avsdfLayout.updateNodeAngles();
// An update for the node coordinates are needed
avsdfLayout.updateNodeCoordinates();
Note that updateNodeAngles() and updateNodeCoordinates() have to be called at each step if you want to take post processing apart instead of doing it in one go as shown above.
FAQs
Library elements of the AVSDF algorithm
The npm package avsdf-base receives a total of 3,271 weekly downloads. As such, avsdf-base popularity was classified as popular.
We found that avsdf-base demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.