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

outdatedDart 1 only

A starting point for Dart libraries or applications.

example/example.dart

// Copyright (c) 2017, Kevin Moore. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:gviz/gviz.dart';

void main() {
  var g = new Graph.fromEdges([
    [1, 2],
    [2, 5],
    [5, 1],
    [2, 6],
    [5, 6],
    [2, 3],
    [6, 7],
    [7, 6],
    [3, 7],
    [3, 4],
    [4, 3],
    [4, 8],
    [8, 4],
    [8, 7]
  ]);

  g.flagConnectedComponents();

  print(g.createGviz(graphStyle: new GStyle()));
}

class GStyle extends GraphStyle {
  @override
  Map<String, String> styleForNode(Object node) {
    var props = super.styleForNode(node);
    if (node is int && node % 2 == 1) {
      props['color'] = 'red';
    }

    return props;
  }

  @override
  Map<String, String> styleForEdge(Edge edge) {
    var props = <String, String>{};

    if (edge.flags.isNotEmpty) {
      props['color'] = 'blue';
    }

    return props;
  }
}
10
likes
0
pub points
85%
popularity

Publisher

verified publisherj832.com

A starting point for Dart libraries or applications.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

collection

More

Packages that depend on gviz