NAME

Graph::Easy::Cluster - Nodes positioned relatively to each other

SYNOPSIS

        use Graph::Easy::Cluster;

	my $bonn = Graph::Easy::Node->new(
		name => 'Bonn',
		border => 'solid 1px black',
		pos => '0,0',
	);
	my $berlin = Graph::Easy::Node->new(
		name => 'Berlin',
		pos => '1,0',
	);
	my $cities = Graph::Easy::Cluster->new();

	$cities->add_node ($bonn);
	# $bonn will be ONCE in the group
	$cities->add_nodes ($bonn, $berlin);
	$cities->set_center($bonn);

DESCRIPTION

A Graph::Easy::Cluster represents a group of nodes that are all positioned relatively to each other.

METHODS

new()

my $cluster = Graph::Easy::Group->new( $options );

Create a new, empty cluster. $options are the possible options, see Graph::Easy::Node for a list. At least an unique name should be passed as option.

error()

$last_error = $group->error();

$group->error($error);			# set new messags
$group->error('');			# clear error

Returns the last error message, or '' for no error.

name()

my $name = $cluster->name();

Return the name of the cluster.

nodes()

my @nodes = $cluster->nodes();

Return all nodes in the cluster.

center_node()

my $center = $cluster->center_node();
$cluster->center_node($new_center);

Get or set the center node. All other nodes will be positioned relatively to the position of the center node.

add_node()

$cluster->add_node( $node );

Add one node to the cluster.

Note: You need to call $node-add_to_cluster($cluster)> afterwards, too.

add_nodes()

$cluster->add_nodes( @nodes );

Add one or more nodes to the cluster.

Note: You need to call $node-add_to_cluster($cluster)> for each node, too.

EXPORT

None by default.

SEE ALSO

Graph::Easy.

AUTHOR

Copyright (C) 2004 - 2005 by Tels http://bloodgate.com

See the LICENSE file for more details.