GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  SPRINGGRAPH (3)

.ds Aq ’

NAME

SpringGraph - Directed Graph alternative to GraphViz

CONTENTS

SYNOPSIS

use SpringGraph qw(calculate_graph draw_graph);

## object oriented interface ##

my $graph = new SpringGraph;

# add a node to the graph (with optional label)

$graph->add_node(’Paris’, label =>’City of Love’);

# add an edge to the graph (with optional label, and directed)

$graph->add_edge(’London’ => ’New York’, label => ’Far’, dir=>1);

# output the graph to a file

$graph->as_png($filename);

# get the graph as GD image object

$graph->as_gd;

## procedural interface ##

my %node = (
         london => { label => ’London (Waterloo)’},
         paris => { label => ’Paris’ },
         brussels => { label => ’Brussels’},
         );

my %link = (
         london => { paris => {style => ’dotted’}, ’new york’ => {} }, # non-directed, dotted and plain lines
         paris => { brussels => { dir => 1} }, # directed from paris to brussels
         );

my $graph = calculate_graph(\%node,\%link);

draw_graph($filename,\%node,\%link);

DESCRIPTION

SpringGraph.pm is a rewrite of the springgraph.pl script, which provides similar functionality to Neato and can read some/most dot files.

The goal of this module is to provide a compatible interface to VCG and/or GraphViz perl modules on CPAN. This module will also provide some extra features to provide more flexibility and power.

METHODS

Class Methods

    new

Constructor for the class, returns a new SpringGraph object

my $graph = SpringGraph->new;

    calculate_graph

returns a hashref of the nodes in the graph, populated with coordinates

my $graph = calculate_graph(\%node,\%link);

    draw_graph

outputs the graph as a png file either to the file specified by the filename or to STDOUT

takes filename, hashref of nodes and list of edges

draw_graph($filename,\%node,\%link);

Object Methods

    add_node

adds a node to a graph

takes the name of the node and any attributes such as label

# just like GraphViz.pm :) $graph->add_node(’Paris’, label =>’City of Love’);

    add_edge

adds an edge to a graph

takes the source and destination of the edge and attributes such as style (dotted or dashed), or if the line is directed or not

$graph->add_edge(’London’ => ’New York’, dir => 1, style=>’dashed’);

    as_png

prints the image of the graph in PNG format

takes an optional filename or outputs directly to STDOUT

$graph->as_png($filename);

    as_gd

returns the GD image object of the graph

my $gd_im = $graph->as_gd;

    as_gd

returns the image of the graph in a string in the format specified or PNG

my $graph_png = $graph->as_image(’png’);

SEE ALSO

GraphViz

springgraph.pl

http://www.chaosreigns.com/code/springgraph/

GD

AUTHOR

Aaron Trevena, based on original script by ’Darxus’

COPYRIGHT

Original Copyright 2002 Darxus AT ChaosReigns DOT com

Amendments and further development copyright 2004 Aaron Trevena

This software is free software. It is made available and licensed under the GNU GPL.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SPRINGGRAPH (3) 2004-07-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.