gviz 0.2.0+1 copy "gviz: ^0.2.0+1" to clipboard
gviz: ^0.2.0+1 copied to clipboard

outdated

Utilities for creating GraphViz graphs.

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

Utilities for creating GraphViz graphs.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

collection

More

Packages that depend on gviz