fcose 0.1.0 copy "fcose: ^0.1.0" to clipboard
fcose: ^0.1.0 copied to clipboard

A pure Dart port of the fCoSE compound graph layout algorithm.

example/fcose_example.dart

import 'package:fcose/fcose.dart';

void main() {
  final graph = FcoseGraph(
    nodes: const [
      FcoseNode(id: 'cluster'),
      FcoseNode(id: 'api', width: 72, height: 48, parentId: 'cluster'),
      FcoseNode(id: 'database', width: 72, height: 48, parentId: 'cluster'),
      FcoseNode(id: 'client', width: 72, height: 48),
    ],
    edges: const [
      FcoseEdge(id: 'request', source: 'client', target: 'api', idealLength: 80),
      FcoseEdge(id: 'query', source: 'api', target: 'database', idealLength: 80),
    ],
  );

  final result = FcoseLayout(
    options: const FcoseOptions(quality: LayoutQuality.proof, seed: 7, idealEdgeLength: 80, maxIterations: 1000),
  ).run(graph);

  for (final node in graph.nodes) {
    print('${node.id}: ${result.rectOf(node.id)}');
  }
}
0
likes
160
points
109
downloads

Documentation

API reference

Publisher

verified publishergugl.org

Weekly Downloads

A pure Dart port of the fCoSE compound graph layout algorithm.

Repository (GitHub)
View/report issues

Topics

#graph #layout #visualization

License

MIT (license)

More

Packages that depend on fcose