# avsdf-base

> Library elements of the AVSDF algorithm

Latest version **1.0.0** (published 2019-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install avsdf-base
pnpm add avsdf-base
yarn add avsdf-base
bun add avsdf-base
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-04-12 |
| First published | 2019-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 56.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | i-Vis |
| Maintainers | ivisatbilkent |

## Links

- npm: https://www.npmjs.com/package/avsdf-base
- Repository: https://github.com/iVis-at-Bilkent/avsdf-base
- Homepage: https://github.com/iVis-at-Bilkent/avsdf-base#readme
- Issues: https://github.com/iVis-at-Bilkent/avsdf-base/issues
- npm.io page: https://npm.io/package/avsdf-base

## Dependencies (1)

- [layout-base](https://npm.io/package/layout-base.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2019-04-12

## README

avsdf-base
================================================================================

## Description

 avsdf-base is a JavaScript library that constitutes of elements helpful in applying the [Circular Drawing Algorithm](https://www.researchgate.net/publication/229019459_New_circular_drawing_algorithms) by Hongmei He & Ondrej Sýkora.
 
 ## Dependencies
 
 * layout-base ^1.0.0
 
 Elements of layout-base can be accessed through this library as well. See below for an example.
 
 ## Usage
  
 Add `avsdf-base` as a dependecy to your layout extension.
 
 `require()` in the extension to reach functionality:
 
```js
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;
```

## API

The main layout and a Graph Manager (see layout-base for details) connected to this layout is needed with 

```js
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. 
 
```js
// 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. 

```js
// 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.

---
_Source: https://npm.io/package/avsdf-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
